|
1 | 1 | output "cloudfront_distribution_id" { |
2 | 2 | description = "The identifier for the distribution." |
3 | | - value = element(concat(aws_cloudfront_distribution.this.*.id, [""]), 0) |
| 3 | + value = try(aws_cloudfront_distribution.this[0].id, "") |
4 | 4 | } |
5 | 5 |
|
6 | 6 | output "cloudfront_distribution_arn" { |
7 | 7 | description = "The ARN (Amazon Resource Name) for the distribution." |
8 | | - value = element(concat(aws_cloudfront_distribution.this.*.arn, [""]), 0) |
| 8 | + value = try(aws_cloudfront_distribution.this[0].arn, "") |
9 | 9 | } |
10 | 10 |
|
11 | 11 | output "cloudfront_distribution_caller_reference" { |
12 | 12 | description = "Internal value used by CloudFront to allow future updates to the distribution configuration." |
13 | | - value = element(concat(aws_cloudfront_distribution.this.*.caller_reference, [""]), 0) |
| 13 | + value = try(aws_cloudfront_distribution.this[0].caller_reference, "") |
14 | 14 | } |
15 | 15 |
|
16 | 16 | output "cloudfront_distribution_status" { |
17 | 17 | description = "The current status of the distribution. Deployed if the distribution's information is fully propagated throughout the Amazon CloudFront system." |
18 | | - value = element(concat(aws_cloudfront_distribution.this.*.status, [""]), 0) |
| 18 | + value = try(aws_cloudfront_distribution.this[0].status, "") |
19 | 19 | } |
20 | 20 |
|
21 | 21 | output "cloudfront_distribution_trusted_signers" { |
22 | 22 | description = "List of nested attributes for active trusted signers, if the distribution is set up to serve private content with signed URLs" |
23 | | - value = element(concat(aws_cloudfront_distribution.this.*.trusted_signers, [""]), 0) |
| 23 | + value = try(aws_cloudfront_distribution.this[0].trusted_signers, "") |
24 | 24 | } |
25 | 25 |
|
26 | 26 | output "cloudfront_distribution_domain_name" { |
27 | 27 | description = "The domain name corresponding to the distribution." |
28 | | - value = element(concat(aws_cloudfront_distribution.this.*.domain_name, [""]), 0) |
| 28 | + value = try(aws_cloudfront_distribution.this[0].domain_name, "") |
29 | 29 | } |
30 | 30 |
|
31 | 31 | output "cloudfront_distribution_last_modified_time" { |
32 | 32 | description = "The date and time the distribution was last modified." |
33 | | - value = element(concat(aws_cloudfront_distribution.this.*.last_modified_time, [""]), 0) |
| 33 | + value = try(aws_cloudfront_distribution.this[0].last_modified_time, "") |
34 | 34 | } |
35 | 35 |
|
36 | 36 | output "cloudfront_distribution_in_progress_validation_batches" { |
37 | 37 | description = "The number of invalidation batches currently in progress." |
38 | | - value = element(concat(aws_cloudfront_distribution.this.*.in_progress_validation_batches, [""]), 0) |
| 38 | + value = try(aws_cloudfront_distribution.this[0].in_progress_validation_batches, "") |
39 | 39 | } |
40 | 40 |
|
41 | 41 | output "cloudfront_distribution_etag" { |
42 | 42 | description = "The current version of the distribution's information." |
43 | | - value = element(concat(aws_cloudfront_distribution.this.*.etag, [""]), 0) |
| 43 | + value = try(aws_cloudfront_distribution.this[0].etag, "") |
44 | 44 | } |
45 | 45 |
|
46 | 46 | output "cloudfront_distribution_hosted_zone_id" { |
47 | 47 | description = "The CloudFront Route 53 zone ID that can be used to route an Alias Resource Record Set to." |
48 | | - value = element(concat(aws_cloudfront_distribution.this.*.hosted_zone_id, [""]), 0) |
| 48 | + value = try(aws_cloudfront_distribution.this[0].hosted_zone_id, "") |
49 | 49 | } |
50 | 50 |
|
51 | 51 | output "cloudfront_origin_access_identities" { |
52 | 52 | description = "The origin access identities created" |
53 | | - value = local.create_origin_access_identity ? { for k, v in aws_cloudfront_origin_access_identity.this : k => v } : {} |
| 53 | + value = { for k, v in aws_cloudfront_origin_access_identity.this : k => v if local.create_origin_access_identity } |
54 | 54 | } |
55 | 55 |
|
56 | 56 | output "cloudfront_origin_access_identity_ids" { |
57 | 57 | description = "The IDS of the origin access identities created" |
58 | | - value = local.create_origin_access_identity ? [for v in aws_cloudfront_origin_access_identity.this : v.id] : [] |
| 58 | + value = [for v in aws_cloudfront_origin_access_identity.this : v.id if local.create_origin_access_identity] |
59 | 59 | } |
60 | 60 |
|
61 | 61 | output "cloudfront_origin_access_identity_iam_arns" { |
62 | 62 | description = "The IAM arns of the origin access identities created" |
63 | | - value = local.create_origin_access_identity ? [for v in aws_cloudfront_origin_access_identity.this : v.iam_arn] : [] |
| 63 | + value = [for v in aws_cloudfront_origin_access_identity.this : v.iam_arn if local.create_origin_access_identity] |
64 | 64 | } |
65 | 65 |
|
66 | 66 | output "cloudfront_monitoring_subscription_id" { |
67 | 67 | description = " The ID of the CloudFront monitoring subscription, which corresponds to the `distribution_id`." |
68 | | - value = element(concat(aws_cloudfront_monitoring_subscription.this.*.id, [""]), 0) |
| 68 | + value = try(aws_cloudfront_monitoring_subscription.this[0].id, "") |
69 | 69 | } |
70 | 70 |
|
71 | 71 | output "cloudfront_distribution_tags" { |
72 | 72 | description = "Tags of the distribution's" |
73 | | - value = element(concat(aws_cloudfront_distribution.this.*.tags_all, [""]), 0) |
| 73 | + value = try(aws_cloudfront_distribution.this[0].tags_all, "") |
74 | 74 | } |
0 commit comments