From ecc67c0f004136b0a948ba64192a6162a51064f6 Mon Sep 17 00:00:00 2001 From: Lucas de Macedo <122332519+lucasmacedot@users.noreply.github.com> Date: Mon, 4 Nov 2024 19:10:35 -0400 Subject: [PATCH] fix: add variable types --- _outputs.tf | 2 +- _variables.tf | 14 ++++++++++++++ route53-record.tf | 2 +- waf.tf | 2 -- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/_outputs.tf b/_outputs.tf index 2daeb1f..e34667a 100644 --- a/_outputs.tf +++ b/_outputs.tf @@ -15,5 +15,5 @@ output "cloudfront_zone_id" { output "aws_cloudfront_origin_access_identity" { description = "Define cloudfront origin access identity" - value = aws_cloudfront_origin_access_identity.default.* + value = aws_cloudfront_origin_access_identity.default[*] } \ No newline at end of file diff --git a/_variables.tf b/_variables.tf index c7487a2..c170da7 100644 --- a/_variables.tf +++ b/_variables.tf @@ -1,13 +1,16 @@ variable "name" { description = "Name of your ECS service" + type = string } variable "cluster_name" { description = "Name of existing ECS Cluster to deploy this app to" + type = string } variable "hostnames" { description = "Hostnames to create DNS record for this app that the cloudfront distribution will accept" + type = list(string) } variable "dynamic_custom_error_response" { @@ -23,32 +26,39 @@ variable "dynamic_custom_error_response" { variable "hostname_create" { description = "Create hostnames in the hosted zone passed?" default = true + type = bool } variable "hosted_zone" { description = "Existing Hosted Zone domain to add hostnames as DNS records" + type = string } variable "alb_cloudfront_key" { description = "Key generated by terraform-aws-ecs module to allow ALB connection from CloudFront" + type = string } variable "alb_dns_name" { description = "ALB DNS Name that CloudFront will point as origin" + type = string } variable "certificate_arn" { description = "Certificate for this app to use in CloudFront (US), must cover `hostname`." + type = string } variable "cloudfront_web_acl_id" { default = "" description = "Optional web acl (WAF) to attach to CloudFront" + type = string } variable "cloudfront_forward_headers" { default = ["*"] description = "Headers to forward to origin from CloudFront" + type = list(string) } variable "cloudfront_logging_bucket" { @@ -66,21 +76,25 @@ variable "cloudfront_logging_prefix" { variable "cloudfront_origin_keepalive_timeout" { default = 5 description = "The amount of time, in seconds, that CloudFront maintains an idle connection with a custom origin server before closing the connection. Valid values are from 1 to 60 seconds." + type = number } variable "cloudfront_origin_read_timeout" { default = 30 description = "The amount of time, in seconds, that CloudFront waits for a response from a custom origin. The value applies both to the time that CloudFront waits for an initial response and the time that CloudFront waits for each subsequent packet. Valid values are from 4 to 60 seconds." + type = number } variable "alarm_cloudfront_500_errors_threshold" { default = 5 description = "Cloudfront 500 Errors rate threshold (use 0 to disable this alarm)" + type = number } variable "alarm_sns_topics_us" { default = [] description = "Alarm topics to create and alert on metrics on US region" + type = list(string) } variable "iam_certificate_id" { diff --git a/route53-record.tf b/route53-record.tf index eef3e23..7bbbdf3 100644 --- a/route53-record.tf +++ b/route53-record.tf @@ -9,5 +9,5 @@ resource "aws_route53_record" "hostname" { name = var.hostnames[count.index] type = var.record_type ttl = "300" - records = [element(aws_cloudfront_distribution.default.*.domain_name, 0)] + records = [element(aws_cloudfront_distribution.default[*].domain_name, 0)] } diff --git a/waf.tf b/waf.tf index e8de4a6..3d74bd5 100644 --- a/waf.tf +++ b/waf.tf @@ -4,8 +4,6 @@ resource "aws_wafv2_web_acl" "waf_cloudfront" { description = "WAF managed rules for Cloudfront" scope = "CLOUDFRONT" - - default_action { allow {} }