You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
2.**Dynamic Name Reference** (`function_name`): Reference module-managed functions by their map key
192
+
```hcl
193
+
function_association = {
194
+
viewer-request = {
195
+
function_name = "viewer-request-function" # Key from cloudfront_functions map
196
+
}
197
+
}
198
+
```
199
+
200
+
The module automatically resolves function ARNs using Terraform's `try()` function, checking for `function_arn` first, then falling back to `function_name` lookup in module-created functions. This eliminates circular dependency issues while maintaining flexibility.
201
+
80
202
## Examples
81
203
82
204
-[Complete](https://github.com/terraform-aws-modules/terraform-aws-cloudfront/tree/master/examples/complete) - Complete example which creates AWS CloudFront distribution and integrates it with other [terraform-aws-modules](https://github.com/terraform-aws-modules) to create additional resources: S3 buckets, Lambda Functions, CloudFront Functions, VPC Origins, ACM Certificate, Route53 Records.
| <aname="input_aliases"></a> [aliases](#input\_aliases)| Extra CNAMEs (alternate domain names), if any, for this distribution. |`list(string)`|`null`| no |
264
+
| <aname="input_cloudfront_functions"></a> [cloudfront\_functions](#input\_cloudfront\_functions)| Map of CloudFront Function configurations. Key is used as default function name if 'name' not specified. | <pre>map(object({<br/> name = optional(string)<br/> runtime = optional(string, "cloudfront-js-2.0")<br/> comment = optional(string)<br/> publish = optional(bool, true)<br/> code = string<br/> key_value_store_associations = optional(list(string), null)<br/> }))</pre> |`{}`| no |
141
265
| <aname="input_comment"></a> [comment](#input\_comment)| Any comments you want to include about the distribution. |`string`|`null`| no |
142
266
| <aname="input_continuous_deployment_policy_id"></a> [continuous\_deployment\_policy\_id](#input\_continuous\_deployment\_policy\_id)| Identifier of a continuous deployment policy. This argument should only be set on a production distribution. |`string`|`null`| no |
267
+
| <aname="input_create_cloudfront_function"></a> [create\_cloudfront\_function](#input\_create\_cloudfront\_function)| Controls if CloudFront Functions should be created |`bool`|`false`| no |
143
268
| <aname="input_create_distribution"></a> [create\_distribution](#input\_create\_distribution)| Controls if CloudFront distribution should be created |`bool`|`true`| no |
144
269
| <aname="input_create_monitoring_subscription"></a> [create\_monitoring\_subscription](#input\_create\_monitoring\_subscription)| If enabled, the resource for monitoring subscription will created. |`bool`|`false`| no |
145
270
| <aname="input_create_origin_access_control"></a> [create\_origin\_access\_control](#input\_create\_origin\_access\_control)| Controls if CloudFront origin access control should be created |`bool`|`false`| no |
@@ -186,6 +311,10 @@ No modules.
186
311
| <aname="output_cloudfront_distribution_status"></a> [cloudfront\_distribution\_status](#output\_cloudfront\_distribution\_status)| The current status of the distribution. Deployed if the distribution's information is fully propagated throughout the Amazon CloudFront system. |
187
312
| <aname="output_cloudfront_distribution_tags"></a> [cloudfront\_distribution\_tags](#output\_cloudfront\_distribution\_tags)| Tags of the distribution's |
188
313
| <aname="output_cloudfront_distribution_trusted_signers"></a> [cloudfront\_distribution\_trusted\_signers](#output\_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 |
314
+
| <aname="output_cloudfront_function_arns"></a> [cloudfront\_function\_arns](#output\_cloudfront\_function\_arns)| The ARNs of the CloudFront Functions created |
315
+
| <aname="output_cloudfront_function_etags"></a> [cloudfront\_function\_etags](#output\_cloudfront\_function\_etags)| The ETags of the CloudFront Functions (DEVELOPMENT stage) |
316
+
| <aname="output_cloudfront_function_live_stage_etags"></a> [cloudfront\_function\_live\_stage\_etags](#output\_cloudfront\_function\_live\_stage\_etags)| The ETags of the CloudFront Functions (LIVE stage) |
317
+
| <aname="output_cloudfront_function_status"></a> [cloudfront\_function\_status](#output\_cloudfront\_function\_status)| The deployment status of the CloudFront Functions |
189
318
| <aname="output_cloudfront_monitoring_subscription_id"></a> [cloudfront\_monitoring\_subscription\_id](#output\_cloudfront\_monitoring\_subscription\_id)| The ID of the CloudFront monitoring subscription, which corresponds to the `distribution_id`. |
190
319
| <aname="output_cloudfront_origin_access_controls"></a> [cloudfront\_origin\_access\_controls](#output\_cloudfront\_origin\_access\_controls)| The origin access controls created |
191
320
| <aname="output_cloudfront_origin_access_controls_ids"></a> [cloudfront\_origin\_access\_controls\_ids](#output\_cloudfront\_origin\_access\_controls\_ids)| The IDS of the origin access identities created |
0 commit comments