Skip to content

Commit dba3421

Browse files
committed
Fix route53_zone_id input var validation
1 parent fcf8663 commit dba3421

2 files changed

Lines changed: 36 additions & 38 deletions

File tree

README.md

Lines changed: 35 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -32,55 +32,53 @@ aws cloudfront create-invalidation \
3232
**NOTICE:** The Terraform documentation in this README is added by [terraform-docs](https://terraform-docs.io) running as a pre-commit hook, see the [.pre-commit-config.yaml](./.pre-commit-config.yaml) file.
3333

3434
<!-- BEGIN_TF_DOCS -->
35-
3635
## Requirements
3736

38-
| Name | Version |
39-
| ------------------------------------------------------------------------ | ------- |
40-
| <a name="requirement_terraform"></a> [terraform](#requirement_terraform) | 1.13.3 |
41-
| <a name="requirement_aws"></a> [aws](#requirement_aws) | ~> 6.15 |
37+
| Name | Version |
38+
|------|---------|
39+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | 1.13.3 |
40+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | ~> 6.15 |
4241

4342
## Providers
4443

45-
| Name | Version |
46-
| ------------------------------------------------ | ------- |
47-
| <a name="provider_aws"></a> [aws](#provider_aws) | ~> 6.15 |
44+
| Name | Version |
45+
|------|---------|
46+
| <a name="provider_aws"></a> [aws](#provider\_aws) | ~> 6.15 |
4847

4948
## Resources
5049

51-
| Name | Type |
52-
| --------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- |
53-
| [aws_cloudfront_distribution.cdn](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudfront_distribution) | resource |
54-
| [aws_cloudfront_origin_access_control.oac](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudfront_origin_access_control) | resource |
55-
| [aws_cloudwatch_log_delivery.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_log_delivery) | resource |
56-
| [aws_cloudwatch_log_delivery_destination.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_log_delivery_destination) | resource |
57-
| [aws_cloudwatch_log_delivery_source.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_log_delivery_source) | resource |
58-
| [aws_cloudwatch_log_group.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_log_group) | resource |
59-
| [aws_route53_record.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_record) | resource |
60-
| [aws_s3_bucket.origin](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket) | resource |
61-
| [aws_s3_bucket_policy.origin](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_policy) | resource |
62-
| [aws_cloudfront_cache_policy.optimize](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/cloudfront_cache_policy) | data source |
63-
| [aws_iam_policy_document.origin](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
50+
| Name | Type |
51+
|------|------|
52+
| [aws_cloudfront_distribution.cdn](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudfront_distribution) | resource |
53+
| [aws_cloudfront_origin_access_control.oac](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudfront_origin_access_control) | resource |
54+
| [aws_cloudwatch_log_delivery.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_log_delivery) | resource |
55+
| [aws_cloudwatch_log_delivery_destination.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_log_delivery_destination) | resource |
56+
| [aws_cloudwatch_log_delivery_source.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_log_delivery_source) | resource |
57+
| [aws_cloudwatch_log_group.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_log_group) | resource |
58+
| [aws_route53_record.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_record) | resource |
59+
| [aws_s3_bucket.origin](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket) | resource |
60+
| [aws_s3_bucket_policy.origin](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_policy) | resource |
61+
| [aws_cloudfront_cache_policy.optimize](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/cloudfront_cache_policy) | data source |
62+
| [aws_iam_policy_document.origin](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
6463

6564
## Inputs
6665

67-
| Name | Description | Type | Default | Required |
68-
| --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | -------------- | ------- | :------: |
69-
| <a name="input_acm_cert_arn"></a> [acm_cert_arn](#input_acm_cert_arn) | ACM certificate to use if aliases are given. A CloudFront cert is used by default | `string` | `null` | no |
70-
| <a name="input_cdn_aliases"></a> [cdn_aliases](#input_cdn_aliases) | n/a | `list(string)` | `[]` | no |
71-
| <a name="input_env"></a> [env](#input_env) | Deploy environment, e.g., prod, dev | `string` | n/a | yes |
72-
| <a name="input_function_association"></a> [function_association](#input_function_association) | Forwarded to the aws_cloudfront_distribution resource | `any` | `null` | no |
73-
| <a name="input_project"></a> [project](#input_project) | Name of the project in lowercase without spaces, e.g., myproject | `string` | n/a | yes |
74-
| <a name="input_route53_zone_id"></a> [route53_zone_id](#input_route53_zone_id) | Hosted zone where the CDN aliases will be added to | `string` | `null` | no |
66+
| Name | Description | Type | Default | Required |
67+
|------|-------------|------|---------|:--------:|
68+
| <a name="input_acm_cert_arn"></a> [acm\_cert\_arn](#input\_acm\_cert\_arn) | ACM certificate to use if aliases are given. A CloudFront cert is used by default | `string` | `null` | no |
69+
| <a name="input_cdn_aliases"></a> [cdn\_aliases](#input\_cdn\_aliases) | n/a | `list(string)` | `[]` | no |
70+
| <a name="input_env"></a> [env](#input\_env) | Deploy environment, e.g., prod, dev | `string` | n/a | yes |
71+
| <a name="input_function_association"></a> [function\_association](#input\_function\_association) | Forwarded to the aws\_cloudfront\_distribution resource | `any` | `null` | no |
72+
| <a name="input_project"></a> [project](#input\_project) | Name of the project in lowercase without spaces, e.g., myproject | `string` | n/a | yes |
73+
| <a name="input_route53_zone_id"></a> [route53\_zone\_id](#input\_route53\_zone\_id) | Hosted zone where the CDN aliases will be added to | `string` | `null` | no |
7574

7675
## Outputs
7776

78-
| Name | Description |
79-
| -------------------------------------------------------------------------------------------------------------------- | --------------------------------------- |
80-
| <a name="output_cloudfront_dist_aliases"></a> [cloudfront_dist_aliases](#output_cloudfront_dist_aliases) | CloudFront distribution aliases |
81-
| <a name="output_cloudfront_dist_domain_name"></a> [cloudfront_dist_domain_name](#output_cloudfront_dist_domain_name) | CloudFront distribution domain name |
82-
| <a name="output_cloudfront_dist_id"></a> [cloudfront_dist_id](#output_cloudfront_dist_id) | CloudFront distribution id |
83-
| <a name="output_cloudfront_hosted_zone_id"></a> [cloudfront_hosted_zone_id](#output_cloudfront_hosted_zone_id) | CloudFront distribution hosted_zone_id |
84-
| <a name="output_s3_bucket_name"></a> [s3_bucket_name](#output_s3_bucket_name) | Name of the S3 bucket used for the site |
85-
77+
| Name | Description |
78+
|------|-------------|
79+
| <a name="output_cloudfront_dist_aliases"></a> [cloudfront\_dist\_aliases](#output\_cloudfront\_dist\_aliases) | CloudFront distribution aliases |
80+
| <a name="output_cloudfront_dist_domain_name"></a> [cloudfront\_dist\_domain\_name](#output\_cloudfront\_dist\_domain\_name) | CloudFront distribution domain name |
81+
| <a name="output_cloudfront_dist_id"></a> [cloudfront\_dist\_id](#output\_cloudfront\_dist\_id) | CloudFront distribution id |
82+
| <a name="output_cloudfront_hosted_zone_id"></a> [cloudfront\_hosted\_zone\_id](#output\_cloudfront\_hosted\_zone\_id) | CloudFront distribution hosted\_zone\_id |
83+
| <a name="output_s3_bucket_name"></a> [s3\_bucket\_name](#output\_s3\_bucket\_name) | Name of the S3 bucket used for the site |
8684
<!-- END_TF_DOCS -->

variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ variable "route53_zone_id" {
3030
default = null
3131

3232
validation {
33-
condition = length(var.cdn_aliases) == 0
33+
condition = length(var.cdn_aliases) == 0 || var.route53_zone_id != null
3434
error_message = "A route53_zone_id is required to create the DNS records for the cdn_aliases"
3535
}
3636
}

0 commit comments

Comments
 (0)