|
| 1 | +output "id" { |
| 2 | + description = "The ID of the CloudFront Function." |
| 3 | + value = { |
| 4 | + "GENERAL" = one(aws_cloudfront_function.this[*].name) |
| 5 | + "CONNECTION" = one(aws_cloudfront_connection_function.this[*].id) |
| 6 | + }[var.type] |
| 7 | +} |
| 8 | + |
| 9 | +output "arn" { |
| 10 | + description = "The ARN of the CloudFront Function." |
| 11 | + value = { |
| 12 | + "GENERAL" = one(aws_cloudfront_function.this[*].arn) |
| 13 | + "CONNECTION" = one(aws_cloudfront_connection_function.this[*].connection_function_arn) |
| 14 | + }[var.type] |
| 15 | +} |
| 16 | + |
| 17 | +output "name" { |
| 18 | + description = "The name of the CloudFront Function." |
| 19 | + value = { |
| 20 | + "GENERAL" = one(aws_cloudfront_function.this[*].name) |
| 21 | + "CONNECTION" = one(aws_cloudfront_connection_function.this[*].name) |
| 22 | + }[var.type] |
| 23 | +} |
| 24 | + |
| 25 | +output "description" { |
| 26 | + description = "The comment describing the CloudFront function." |
| 27 | + value = { |
| 28 | + "GENERAL" = one(aws_cloudfront_function.this[*].comment) |
| 29 | + "CONNECTION" = one(aws_cloudfront_connection_function.this[*].connection_function_config[0].comment) |
| 30 | + }[var.type] |
| 31 | +} |
| 32 | + |
| 33 | +output "type" { |
| 34 | + description = "The type of the CloudFront Function." |
| 35 | + value = var.type |
| 36 | +} |
| 37 | + |
| 38 | +output "status" { |
| 39 | + description = "The status of the function. Can be UNPUBLISHED, UNASSOCIATED or ASSOCIATED." |
| 40 | + value = { |
| 41 | + "GENERAL" = one(aws_cloudfront_function.this[*].status) |
| 42 | + "CONNECTION" = one(aws_cloudfront_connection_function.this[*].status) |
| 43 | + }[var.type] |
| 44 | +} |
| 45 | + |
| 46 | +output "runtime" { |
| 47 | + description = "The runtime environment for the function." |
| 48 | + value = { |
| 49 | + "GENERAL" = one(aws_cloudfront_function.this[*].runtime) |
| 50 | + "CONNECTION" = one(aws_cloudfront_connection_function.this[*].connection_function_config[0].runtime) |
| 51 | + }[var.type] |
| 52 | +} |
| 53 | + |
| 54 | +output "key_value_store" { |
| 55 | + description = "The ARN of the CloudFront Key Value Store associated with the function, if any." |
| 56 | + value = try( |
| 57 | + one(aws_cloudfront_function.this[0].key_value_store_associations[*]), |
| 58 | + aws_cloudfront_connection_function.this[0].connection_function_config[0].key_value_store_association[0].key_value_store_arn, |
| 59 | + var.key_value_store, |
| 60 | + ) |
| 61 | +} |
| 62 | + |
| 63 | +output "etag" { |
| 64 | + description = "The ETag hash of the function. This is the value for the DEVELOPMENT stage of the function." |
| 65 | + value = { |
| 66 | + "GENERAL" = one(aws_cloudfront_function.this[*].etag) |
| 67 | + "CONNECTION" = one(aws_cloudfront_connection_function.this[*].etag) |
| 68 | + }[var.type] |
| 69 | +} |
| 70 | + |
| 71 | +output "live_stage_etag" { |
| 72 | + description = "The ETag hash of the LIVE stage of the function. Will be empty if the function has not been published." |
| 73 | + value = { |
| 74 | + "GENERAL" = one(aws_cloudfront_function.this[*].live_stage_etag) |
| 75 | + "CONNECTION" = one(aws_cloudfront_connection_function.this[*].live_stage_etag) |
| 76 | + }[var.type] |
| 77 | +} |
| 78 | + |
| 79 | +output "resource_group" { |
| 80 | + description = "The resource group created to manage resources in this module." |
| 81 | + value = merge( |
| 82 | + { |
| 83 | + enabled = var.resource_group.enabled && var.module_tags_enabled |
| 84 | + }, |
| 85 | + (var.resource_group.enabled && var.module_tags_enabled |
| 86 | + ? { |
| 87 | + arn = module.resource_group[0].arn |
| 88 | + name = module.resource_group[0].name |
| 89 | + } |
| 90 | + : {} |
| 91 | + ) |
| 92 | + ) |
| 93 | +} |
| 94 | + |
| 95 | +# output "debug" { |
| 96 | +# value = try( |
| 97 | +# { |
| 98 | +# for k, v in one(aws_cloudfront_function.this[*]) : |
| 99 | +# k => v |
| 100 | +# if !contains(["id", "arn", "name", "comment", "runtime", "etag", "live_stage_etag", "status", "publish", "code", "key_value_store_associations"], k) |
| 101 | +# }, |
| 102 | +# { |
| 103 | +# for k, v in one(aws_cloudfront_connection_function.this[*]) : |
| 104 | +# k => v |
| 105 | +# if !contains(["id", "connection_function_arn", "name", "etag", "live_stage_etag", "status", "publish"], k) |
| 106 | +# } |
| 107 | +# ) |
| 108 | +# } |
0 commit comments