Skip to content

Commit

Permalink
refactor: change origin access identity output types (terraform-aws-m…
Browse files Browse the repository at this point in the history
  • Loading branch information
wolffberg authored Dec 4, 2020
1 parent 4a356f9 commit cf2e192
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
terraform.tfstate
*.tfstate*
terraform.tfvars
.terraform.lock.hcl
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: git://github.com/antonbabenko/pre-commit-terraform
rev: v1.43.0
rev: v1.45.0
hooks:
- id: terraform_fmt
- id: terraform_docs
Expand All @@ -20,6 +20,6 @@ repos:
- '--args=--only=terraform_standard_module_structure'
- '--args=--only=terraform_workspace_remote'
- repo: git://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
rev: v3.3.0
hooks:
- id: check-merge-conflict
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,9 @@ module "cdn" {
| this\_cloudfront\_distribution\_last\_modified\_time | The date and time the distribution was last modified. |
| this\_cloudfront\_distribution\_status | The current status of the distribution. Deployed if the distribution's information is fully propagated throughout the Amazon CloudFront system. |
| this\_cloudfront\_distribution\_trusted\_signers | List of nested attributes for active trusted signers, if the distribution is set up to serve private content with signed URLs |
| this\_cloudfront\_origin\_access\_identity\_iam\_arns | The IAM arns of the origin access identities created |
| this\_cloudfront\_origin\_access\_identity\_ids | The IDS of the origin access identities created |
| this\_cloudfront\_origin\_access\_identities | Map of origin access identities created |
| this\_cloudfront\_origin\_access\_identity\_iam\_arns | List of IAM arns of the origin access identities created |
| this\_cloudfront\_origin\_access\_identity\_ids | List of IDS of the origin access identities created |

<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

Expand Down
3 changes: 3 additions & 0 deletions examples/complete/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,8 @@ No input.
| this\_cloudfront\_distribution\_last\_modified\_time | The date and time the distribution was last modified. |
| this\_cloudfront\_distribution\_status | The current status of the distribution. Deployed if the distribution's information is fully propagated throughout the Amazon CloudFront system. |
| this\_cloudfront\_distribution\_trusted\_signers | List of nested attributes for active trusted signers, if the distribution is set up to serve private content with signed URLs |
| this\_cloudfront\_origin\_access\_identities | Map of origin access identities created |
| this\_cloudfront\_origin\_access\_identity\_iam\_arns | List of IAM arns of the origin access identities created |
| this\_cloudfront\_origin\_access\_identity\_ids | List of IDS of the origin access identities created |

<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
4 changes: 2 additions & 2 deletions examples/complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -252,11 +252,11 @@ module "records" {
data "aws_iam_policy_document" "s3_policy" {
statement {
actions = ["s3:GetObject"]
resources = ["${module.s3_one.this_s3_bucket_arn}/uploads/*"]
resources = ["${module.s3_one.this_s3_bucket_arn}/static/*"]

principals {
type = "AWS"
identifiers = [for k, v in module.cloudfront.this_cloudfront_origin_access_identity_iam_arns : v]
identifiers = module.cloudfront.this_cloudfront_origin_access_identity_iam_arns
}
}
}
Expand Down
15 changes: 15 additions & 0 deletions examples/complete/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,18 @@ output "this_cloudfront_distribution_hosted_zone_id" {
description = "The CloudFront Route 53 zone ID that can be used to route an Alias Resource Record Set to."
value = module.cloudfront.this_cloudfront_distribution_hosted_zone_id
}

output "this_cloudfront_origin_access_identities" {
description = "The origin access identities created"
value = module.cloudfront.this_cloudfront_origin_access_identities
}

output "this_cloudfront_origin_access_identity_ids" {
description = "The IDS of the origin access identities created"
value = module.cloudfront.this_cloudfront_origin_access_identity_ids
}

output "this_cloudfront_origin_access_identity_iam_arns" {
description = "The IAM arns of the origin access identities created"
value = module.cloudfront.this_cloudfront_origin_access_identity_iam_arns
}
9 changes: 7 additions & 2 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,17 @@ output "this_cloudfront_distribution_hosted_zone_id" {
value = element(concat(aws_cloudfront_distribution.this.*.hosted_zone_id, list("")), 0)
}

output "this_cloudfront_origin_access_identities" {
description = "The origin access identities created"
value = local.create_origin_access_identity ? { for k, v in aws_cloudfront_origin_access_identity.this : k => v } : {}
}

output "this_cloudfront_origin_access_identity_ids" {
description = "The IDS of the origin access identities created"
value = local.create_origin_access_identity ? { for k, v in var.origin_access_identities : k => aws_cloudfront_origin_access_identity.this[k].id } : {}
value = local.create_origin_access_identity ? [for v in aws_cloudfront_origin_access_identity.this : v.id] : []
}

output "this_cloudfront_origin_access_identity_iam_arns" {
description = "The IAM arns of the origin access identities created"
value = local.create_origin_access_identity ? { for k, v in var.origin_access_identities : k => aws_cloudfront_origin_access_identity.this[k].iam_arn } : {}
value = local.create_origin_access_identity ? [for v in aws_cloudfront_origin_access_identity.this : v.iam_arn] : []
}

0 comments on commit cf2e192

Please sign in to comment.