Skip to content

Commit

Permalink
fix!: Rename outputs to match AWS provider resource
Browse files Browse the repository at this point in the history
  • Loading branch information
baolsen committed Dec 18, 2023
1 parent 71f885b commit a8f1eb6
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ No modules.

| Name | Description |
|------|-------------|
| <a name="output_arn"></a> [arn](#output\_arn) | The bucket ARN that is created. |
| <a name="output_bucket"></a> [bucket](#output\_bucket) | The bucket that is created. |
| <a name="output_bucket_arn"></a> [bucket\_arn](#output\_bucket\_arn) | The bucket ARN that is created. |
| <a name="output_bucket_id"></a> [bucket\_id](#output\_bucket\_id) | The bucket id that is created. |
| <a name="output_default_bucket_policy_document"></a> [default\_bucket\_policy\_document](#output\_default\_bucket\_policy\_document) | Default bucket policy document, attached to the bucket if `var.attach_default_bucket_policy=true`. |
| <a name="output_id"></a> [id](#output\_id) | The bucket id that is created. |
| <a name="output_kms_key_id"></a> [kms\_key\_id](#output\_kms\_key\_id) | The KMS key ID used for encrypting bucket objects. |
| <a name="output_region"></a> [region](#output\_region) | The bucket region. |

Expand Down
23 changes: 23 additions & 0 deletions examples/basic/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,27 @@ resource "aws_kms_key" "key" {
deletion_window_in_days = 7
}
# Optional KMS key policy.
data "aws_caller_identity" "current" {}
resource "aws_kms_key_policy" "key" {
key_id = aws_kms_key.key.id
policy = jsonencode({
Id = "example"
Statement = [
{
Action = "kms:*"
Effect = "Allow"
Principal = {
AWS = data.aws_caller_identity.current.account_id
}
Resource = "*"
Sid = "Enable IAM User Permissions"
},
]
Version = "2012-10-17"
})
}
#--------------------------------------------------------------------------------------
# Example
#--------------------------------------------------------------------------------------
Expand Down Expand Up @@ -91,7 +112,9 @@ module "example" {
| Name | Type |
|------|------|
| [aws_kms_key.key](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/kms_key) | resource |
| [aws_kms_key_policy.key](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/kms_key_policy) | resource |
| [random_integer.naming](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/integer) | resource |
| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |

----
<!-- END_TF_DOCS -->
21 changes: 21 additions & 0 deletions examples/basic/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,27 @@ resource "aws_kms_key" "key" {
deletion_window_in_days = 7
}

# Optional KMS key policy.
data "aws_caller_identity" "current" {}
resource "aws_kms_key_policy" "key" {
key_id = aws_kms_key.key.id
policy = jsonencode({
Id = "example"
Statement = [
{
Action = "kms:*"
Effect = "Allow"
Principal = {
AWS = data.aws_caller_identity.current.account_id
}
Resource = "*"
Sid = "Enable IAM User Permissions"
},
]
Version = "2012-10-17"
})
}

#--------------------------------------------------------------------------------------
# Example
#--------------------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions outputs.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
output "bucket_arn" {
output "arn" {
description = "The bucket ARN that is created."
value = aws_s3_bucket.this.arn
}
Expand All @@ -8,7 +8,7 @@ output "bucket" {
value = aws_s3_bucket.this.bucket
}

output "bucket_id" {
output "id" {
description = "The bucket id that is created."
value = aws_s3_bucket.this.id
}
Expand Down

0 comments on commit a8f1eb6

Please sign in to comment.