Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
badra001 committed Nov 17, 2021
1 parent 0359812 commit 3bd270d
Show file tree
Hide file tree
Showing 4 changed files with 115 additions and 31 deletions.
47 changes: 39 additions & 8 deletions kms_key/README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,48 @@
# About aws-s3 :: kms\_key

This submodule allows you to create a KMS key for use with S3 buckets.
This submodule allows you to create a KMS key for use with S3 buckets. You have to create the key first
before trying to call it in a module. This is useful if you have a lot of buckets you wish to share the
same key.

# Usage
## Usage: Create

```hcl
module "mykey" {
source = "git@github.e.it.census.gov:terraform-modules/aws-s3.git//kms_key"
key_name = "mykeyname"
module "simple-key" {
source = "git@github.e.it.census.gov:terraform-modules/aws-s3.git//kms_key"
key_name = "my-simple-key"
## optional
# kms_admin_roles = [ aws_iam_role.cloud-admin.arn ]
# kms_policy_document = data.aws_iam_policy_document.mypolicy.json
}
output "simple-key-info" {
description = "KMS Key Info"
value = {
arn = module.simple-key.kms_key_arn
id = module.simple-key.kms_key_id
alias = module.simple-key.kms_key_alias
}
}
```

## Usage: Reference
```hcl
module "my-bucket" {
source = "git@github.e.it.census.gov:terraform-modules/aws-s3.git//standard"
bucket_name = "my-normalbucket"
access_log_bucket = "my-logbucket"
kms_key_arn = module.simple-key.kms_key_arn
}
output "my-bucket-info" {
description = "S3 Standard Bucket Info"
value = {
arn = module.my-bucket.s3_bucket_arn
id = module.my-bucket.s3_bucket_id
}
}
```

## Requirements
Expand Down Expand Up @@ -40,6 +70,7 @@ No modules.
| [aws_iam_policy_document.empty](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
| [aws_iam_policy_document.key_admin](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
| [aws_iam_policy_document.key_policy_combined](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
| [aws_kms_key.incoming_key](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/kms_key) | data source |
| [aws_region.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) | data source |

## Inputs
Expand All @@ -59,6 +90,6 @@ No modules.

| Name | Description |
|------|-------------|
| <a name="output_kms_key_alias"></a> [kms\_key\_alias](#output\_kms\_key\_alias) | Created KMS Key Alias name |
| <a name="output_kms_key_arn"></a> [kms\_key\_arn](#output\_kms\_key\_arn) | Created KMS Key ARN |
| <a name="output_kms_key_id"></a> [kms\_key\_id](#output\_kms\_key\_id) | Created KMS Key ID |
| <a name="output_kms_key_alias"></a> [kms\_key\_alias](#output\_kms\_key\_alias) | KMS Key Alias name. If a kms\_key\_arn passed in, this will be null. |
| <a name="output_kms_key_arn"></a> [kms\_key\_arn](#output\_kms\_key\_arn) | KMS Key ARN. This is the created key ARN or the key ARN of kms\_key\_arn |
| <a name="output_kms_key_id"></a> [kms\_key\_id](#output\_kms\_key\_id) | KMS Key ID. This is the created key id or the key id of kms\_key\_arn |
46 changes: 40 additions & 6 deletions kms_key/main.tf
Original file line number Diff line number Diff line change
@@ -1,19 +1,49 @@
/*
* # About aws-s3 :: kms_key
*
* This submodule allows you to create a KMS key for use with S3 buckets.
* This submodule allows you to create a KMS key for use with S3 buckets. You have to create the key first
* before trying to call it in a module. This is useful if you have a lot of buckets you wish to share the
* same key.
*
* # Usage
* ## Usage: Create
*
* ```hcl
* module "mykey" {
* source = "git@github.e.it.census.gov:terraform-modules/aws-s3.git//kms_key"
* key_name = "mykeyname"
*
* module "simple-key" {
* source = "git@github.e.it.census.gov:terraform-modules/aws-s3.git//kms_key"
* key_name = "my-simple-key"
*
* ## optional
* # kms_admin_roles = [ aws_iam_role.cloud-admin.arn ]
* # kms_policy_document = data.aws_iam_policy_document.mypolicy.json
* }
*
* output "simple-key-info" {
* description = "KMS Key Info"
* value = {
* arn = module.simple-key.kms_key_arn
* id = module.simple-key.kms_key_id
* alias = module.simple-key.kms_key_alias
* }
* }
* ```
*
* ## Usage: Reference
* ```hcl
* module "my-bucket" {
* source = "git@github.e.it.census.gov:terraform-modules/aws-s3.git//standard"
*
* bucket_name = "my-normalbucket"
* access_log_bucket = "my-logbucket"
* kms_key_arn = module.simple-key.kms_key_arn
* }
*
* output "my-bucket-info" {
* description = "S3 Standard Bucket Info"
* value = {
* arn = module.my-bucket.s3_bucket_arn
* id = module.my-bucket.s3_bucket_id
* }
* }
* ```
*/

Expand All @@ -22,3 +52,7 @@ locals {
name = var.key_name
enable_title26 = var.enable_title26 ? true : false
}




27 changes: 18 additions & 9 deletions standard/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,24 @@ Other configurations such as versioning or data safegurad tagging (only on the b
# Usage

```hcl
module "mybucket" {
module "my-bucket" {
source = "git@github.e.it.census.gov:terraform-modules/aws-s3.git//standard"
bucket_name = "mynormalbucket"
access_log_bucket = "mylogbucket"
kms_admin_roles = [ aws_iam_role.cloud-admin.arn ]
bucket_name = "my-normalbucket"
access_log_bucket = "my-logbucket"
# kms_admin_roles = [ aws_iam_role.cloud-admin.arn ]
## optional
# kms_policy_document = data.aws_iam_policy_document.mypolicy.json
# bucket_policy_document = data.aws_iam_policy_document.mybucketpolicy.json
# kms_policy_document = data.aws_iam_policy_document.my-policy.json
# bucket_policy_document = data.aws_iam_policy_document.my-bucketpolicy.json
}
output "my-bucket-info" {
description = "S3 Standard Bucket Info"
value = {
arn = module.my-bucket.s3_bucket_arn
id = module.my-bucket.s3_bucket_id
}
}
```

Expand Down Expand Up @@ -116,6 +124,7 @@ No modules.
| [aws_iam_policy_document.key_admin](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
| [aws_iam_policy_document.key_policy_combined](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
| [aws_iam_policy_document.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
| [aws_kms_key.incoming_key](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/kms_key) | data source |
| [aws_region.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) | data source |

## Inputs
Expand Down Expand Up @@ -144,8 +153,8 @@ No modules.

| Name | Description |
|------|-------------|
| <a name="output_kms_key_alias"></a> [kms\_key\_alias](#output\_kms\_key\_alias) | Created KMS Key Alias name |
| <a name="output_kms_key_arn"></a> [kms\_key\_arn](#output\_kms\_key\_arn) | Created KMS Key ARN |
| <a name="output_kms_key_id"></a> [kms\_key\_id](#output\_kms\_key\_id) | Created KMS Key ID |
| <a name="output_kms_key_alias"></a> [kms\_key\_alias](#output\_kms\_key\_alias) | KMS Key Alias name. If a kms\_key\_arn passed in, this will be null. |
| <a name="output_kms_key_arn"></a> [kms\_key\_arn](#output\_kms\_key\_arn) | KMS Key ARN. This is the created key ARN or the key ARN of kms\_key\_arn |
| <a name="output_kms_key_id"></a> [kms\_key\_id](#output\_kms\_key\_id) | KMS Key ID. This is the created key id or the key id of kms\_key\_arn |
| <a name="output_s3_bucket_arn"></a> [s3\_bucket\_arn](#output\_s3\_bucket\_arn) | Created S3 Bucket ARN |
| <a name="output_s3_bucket_id"></a> [s3\_bucket\_id](#output\_s3\_bucket\_id) | Created S3 Bucket ID |
26 changes: 18 additions & 8 deletions standard/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,24 @@
* # Usage
*
* ```hcl
* module "mybucket" {
* module "my-bucket" {
* source = "git@github.e.it.census.gov:terraform-modules/aws-s3.git//standard"
*
* bucket_name = "mynormalbucket"
* access_log_bucket = "mylogbucket"
* kms_admin_roles = [ aws_iam_role.cloud-admin.arn ]
*
*
* bucket_name = "my-normalbucket"
* access_log_bucket = "my-logbucket"
* # kms_admin_roles = [ aws_iam_role.cloud-admin.arn ]
*
* ## optional
* # kms_policy_document = data.aws_iam_policy_document.mypolicy.json
* # bucket_policy_document = data.aws_iam_policy_document.mybucketpolicy.json
* # kms_policy_document = data.aws_iam_policy_document.my-policy.json
* # bucket_policy_document = data.aws_iam_policy_document.my-bucketpolicy.json
* }
*
* output "my-bucket-info" {
* description = "S3 Standard Bucket Info"
* value = {
* arn = module.my-bucket.s3_bucket_arn
* id = module.my-bucket.s3_bucket_id
* }
* }
* ```
*
Expand Down Expand Up @@ -89,3 +97,5 @@ locals {
enable_title26 = var.enable_title26 ? true : false
versioning = false
}


0 comments on commit 3bd270d

Please sign in to comment.