From 3c4dc7949826f3839b568b75fe7fc762b0f35090 Mon Sep 17 00:00:00 2001 From: Juan Sanchez Date: Wed, 25 Mar 2020 13:31:48 +0100 Subject: [PATCH 1/3] Update and fix examples versioning and syntax --- examples/autoscaling/main.tf | 6 +++--- examples/autoscaling/outputs.tf | 14 +++++++------- examples/basic/main.tf | 4 ++-- examples/basic/outputs.tf | 14 +++++++------- examples/cross-sg-services/main.tf | 2 +- examples/cross-sg-services/outputs.tf | 14 +++++++------- examples/external_vpc/main.tf | 22 +++++++++++----------- examples/https_enabled/main.tf | 24 ++++++++++++------------ examples/https_enabled/outputs.tf | 14 +++++++------- 9 files changed, 57 insertions(+), 57 deletions(-) diff --git a/examples/autoscaling/main.tf b/examples/autoscaling/main.tf index 3780d99..d6a7b4b 100644 --- a/examples/autoscaling/main.tf +++ b/examples/autoscaling/main.tf @@ -1,9 +1,9 @@ terraform { - required_version = "~> 0.11.11" + required_version = "~> 0.12" } provider "aws" { - version = "~> 1.54.0" + version = "~> 2.12.0" region = "us-east-1" profile = "playground" } @@ -21,7 +21,7 @@ module "fargate" { memory = "512" replicas = 3 - auto_scaling_max_replicas = 5 // Will scale out up to 5 replicas + auto_scaling_max_replicas = 5 // Will scale out up to 5 replicas auto_scaling_max_cpu_util = 60 // If Avg CPU Utilization reaches 60%, scale up operations gets triggered } } diff --git a/examples/autoscaling/outputs.tf b/examples/autoscaling/outputs.tf index e508b66..c882c9e 100644 --- a/examples/autoscaling/outputs.tf +++ b/examples/autoscaling/outputs.tf @@ -1,33 +1,33 @@ # VPC output "vpc" { - value = "${module.fargate.vpc}" + value = module.fargate.vpc_id } # ECR output "ecr" { - value = "${module.fargate.ecr_repository}" + value = module.fargate.ecr_repository_urls } # ECS Cluster output "ecs_cluster" { - value = "${module.fargate.ecs_cluster}" + value = module.fargate.ecs_cluster_arn } # ALBs output "application_load_balancers" { - value = "${module.fargate.application_load_balancers}" + value = module.fargate.application_load_balancers_arns } # Security Groups output "web_security_group" { - value = "${module.fargate.web_security_group}" + value = module.fargate.web_security_group_arn } output "services_security_groups" { - value = "${module.fargate.services_security_groups}" + value = module.fargate.services_security_groups_arns } # CloudWatch output "cloudwatch_log_groups" { - value = "${module.fargate.cloudwatch_log_groups}" + value = module.fargate.cloudwatch_log_group_names } diff --git a/examples/basic/main.tf b/examples/basic/main.tf index 0d79f50..b4b4ce8 100644 --- a/examples/basic/main.tf +++ b/examples/basic/main.tf @@ -1,9 +1,9 @@ terraform { - required_version = "~> 0.11.11" + required_version = "~> 0.12" } provider "aws" { - version = "~> 1.54.0" + version = "~> 2.12.0" region = "us-east-1" profile = "playground" } diff --git a/examples/basic/outputs.tf b/examples/basic/outputs.tf index e508b66..c882c9e 100644 --- a/examples/basic/outputs.tf +++ b/examples/basic/outputs.tf @@ -1,33 +1,33 @@ # VPC output "vpc" { - value = "${module.fargate.vpc}" + value = module.fargate.vpc_id } # ECR output "ecr" { - value = "${module.fargate.ecr_repository}" + value = module.fargate.ecr_repository_urls } # ECS Cluster output "ecs_cluster" { - value = "${module.fargate.ecs_cluster}" + value = module.fargate.ecs_cluster_arn } # ALBs output "application_load_balancers" { - value = "${module.fargate.application_load_balancers}" + value = module.fargate.application_load_balancers_arns } # Security Groups output "web_security_group" { - value = "${module.fargate.web_security_group}" + value = module.fargate.web_security_group_arn } output "services_security_groups" { - value = "${module.fargate.services_security_groups}" + value = module.fargate.services_security_groups_arns } # CloudWatch output "cloudwatch_log_groups" { - value = "${module.fargate.cloudwatch_log_groups}" + value = module.fargate.cloudwatch_log_group_names } diff --git a/examples/cross-sg-services/main.tf b/examples/cross-sg-services/main.tf index 9d944b5..4f3e0f4 100644 --- a/examples/cross-sg-services/main.tf +++ b/examples/cross-sg-services/main.tf @@ -1,7 +1,7 @@ # ⚠️ Only for TF version >=0.12 terraform { - required_version = "~> 0.12.0" + required_version = "~> 0.12" } provider "aws" { diff --git a/examples/cross-sg-services/outputs.tf b/examples/cross-sg-services/outputs.tf index e508b66..c882c9e 100644 --- a/examples/cross-sg-services/outputs.tf +++ b/examples/cross-sg-services/outputs.tf @@ -1,33 +1,33 @@ # VPC output "vpc" { - value = "${module.fargate.vpc}" + value = module.fargate.vpc_id } # ECR output "ecr" { - value = "${module.fargate.ecr_repository}" + value = module.fargate.ecr_repository_urls } # ECS Cluster output "ecs_cluster" { - value = "${module.fargate.ecs_cluster}" + value = module.fargate.ecs_cluster_arn } # ALBs output "application_load_balancers" { - value = "${module.fargate.application_load_balancers}" + value = module.fargate.application_load_balancers_arns } # Security Groups output "web_security_group" { - value = "${module.fargate.web_security_group}" + value = module.fargate.web_security_group_arn } output "services_security_groups" { - value = "${module.fargate.services_security_groups}" + value = module.fargate.services_security_groups_arns } # CloudWatch output "cloudwatch_log_groups" { - value = "${module.fargate.cloudwatch_log_groups}" + value = module.fargate.cloudwatch_log_group_names } diff --git a/examples/external_vpc/main.tf b/examples/external_vpc/main.tf index 96018a2..f288dc4 100644 --- a/examples/external_vpc/main.tf +++ b/examples/external_vpc/main.tf @@ -1,9 +1,9 @@ terraform { - required_version = ">= 0.11.13" + required_version = "~> 0.12" } provider "aws" { - version = "~> 2.6.0" + version = "~> 2.12.0" region = "us-east-1" profile = "playground" } @@ -18,7 +18,7 @@ variable "private_subnets_cidrs" { module "vpc" { source = "terraform-aws-modules/vpc/aws" - version = "1.60.0" + version = "2.9.0" create_vpc = true @@ -26,8 +26,8 @@ module "vpc" { cidr = "10.0.0.0/16" azs = ["us-east-1a", "us-east-1b", "us-east-1c"] - public_subnets = "${var.public_subnets_cidrs}" - private_subnets = "${var.private_subnets_cidrs}" + public_subnets = var.public_subnets_cidrs + private_subnets = var.private_subnets_cidrs } module "fargate" { @@ -35,14 +35,14 @@ module "fargate" { name = "external-vpc-example" - vpc_create = false # This variable must be set to false, otherwise the module will create its own VPC - vpc_external_id = "${module.vpc.vpc_id}" + vpc_create = false # This variable must be set to false, otherwise the module will create its own VPC + vpc_external_id = module.vpc.vpc_id - vpc_public_subnets = "${var.public_subnets_cidrs}" - vpc_private_subnets = "${var.private_subnets_cidrs}" + vpc_public_subnets = var.public_subnets_cidrs + vpc_private_subnets = var.private_subnets_cidrs - vpc_external_public_subnets_ids = "${module.vpc.public_subnets}" - vpc_external_private_subnets_ids = "${module.vpc.private_subnets}" + vpc_external_public_subnets_ids = module.vpc.public_subnets + vpc_external_private_subnets_ids = module.vpc.private_subnets services = { api = { diff --git a/examples/https_enabled/main.tf b/examples/https_enabled/main.tf index e0775fc..9fdda8d 100644 --- a/examples/https_enabled/main.tf +++ b/examples/https_enabled/main.tf @@ -1,9 +1,9 @@ terraform { - required_version = "~> 0.11.11" + required_version = "~> 0.12" } provider "aws" { - version = "~> 1.54.0" + version = "~> 2.12.0" region = "us-east-1" profile = "playground" } @@ -21,26 +21,26 @@ resource "aws_acm_certificate" "this" { } resource "aws_route53_record" "cert_validation" { - name = "${aws_acm_certificate.this.domain_validation_options.0.resource_record_name}" - type = "${aws_acm_certificate.this.domain_validation_options.0.resource_record_type}" - zone_id = "${data.aws_route53_zone.this.id}" - records = ["${aws_acm_certificate.this.domain_validation_options.0.resource_record_value}"] + name = aws_acm_certificate.this.domain_validation_options.0.resource_record_name + type = aws_acm_certificate.this.domain_validation_options.0.resource_record_type + zone_id = data.aws_route53_zone.this.id + records = [aws_acm_certificate.this.domain_validation_options.0.resource_record_value] ttl = 60 } resource "aws_acm_certificate_validation" "this" { - certificate_arn = "${aws_acm_certificate.this.arn}" - validation_record_fqdns = ["${aws_route53_record.cert_validation.fqdn}"] + certificate_arn = aws_acm_certificate.this.arn + validation_record_fqdns = [aws_route53_record.cert_validation.fqdn] } resource "aws_route53_record" "subdomain" { name = "this-is-my.https-example.dev" - zone_id = "${data.aws_route53_zone.this.id}" + zone_id = data.aws_route53_zone.this.id type = "A" alias { - name = "${module.fargate.application_load_balancers_dns_names[0]}" # Position 0 because we only have one Fargate service (api) - zone_id = "${module.fargate.application_load_balancers_zone_ids[0]}" # Same here + name = module.fargate.application_load_balancers_dns_names[0] # Position 0 because we only have one Fargate service (api) + zone_id = module.fargate.application_load_balancers_zone_ids[0] # Same here evaluate_target_health = true } } @@ -64,7 +64,7 @@ module "fargate" { logs_retention_days = 14 # Optional. 30 by default # To activate SSL Listener (HTTPS) set the ARN of the ACM certificate here! 🔑 - acm_certificate_arn = "${aws_acm_certificate.this.arn}" + acm_certificate_arn = aws_acm_certificate.this.arn } } } diff --git a/examples/https_enabled/outputs.tf b/examples/https_enabled/outputs.tf index e508b66..c882c9e 100644 --- a/examples/https_enabled/outputs.tf +++ b/examples/https_enabled/outputs.tf @@ -1,33 +1,33 @@ # VPC output "vpc" { - value = "${module.fargate.vpc}" + value = module.fargate.vpc_id } # ECR output "ecr" { - value = "${module.fargate.ecr_repository}" + value = module.fargate.ecr_repository_urls } # ECS Cluster output "ecs_cluster" { - value = "${module.fargate.ecs_cluster}" + value = module.fargate.ecs_cluster_arn } # ALBs output "application_load_balancers" { - value = "${module.fargate.application_load_balancers}" + value = module.fargate.application_load_balancers_arns } # Security Groups output "web_security_group" { - value = "${module.fargate.web_security_group}" + value = module.fargate.web_security_group_arn } output "services_security_groups" { - value = "${module.fargate.services_security_groups}" + value = module.fargate.services_security_groups_arns } # CloudWatch output "cloudwatch_log_groups" { - value = "${module.fargate.cloudwatch_log_groups}" + value = module.fargate.cloudwatch_log_group_names } From 5acd3634f45026fdadecd15fc6862848d1553586 Mon Sep 17 00:00:00 2001 From: Juan Sanchez Date: Wed, 25 Mar 2020 13:32:26 +0100 Subject: [PATCH 2/3] Bump version --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 56d9a6e..d1fc21e 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ The goal of this effort is to provide tools/configuration files/scripts/other to ```HCL module "fargate" { source = "strvcom/fargate/aws" - version = "0.17.0" + version = "0.17.1" name = "usage-example" # String, Required: this name will be used for many components of your infrastructure (vpc, loadbalancer, ecs cluster, etc...) From 2e487c189fc16c8ed169c9f12f0a375e0bfeb31d Mon Sep 17 00:00:00 2001 From: Juan Sanchez Date: Wed, 25 Mar 2020 23:26:50 +0100 Subject: [PATCH 3/3] Revert versioning bump --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d1fc21e..56d9a6e 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ The goal of this effort is to provide tools/configuration files/scripts/other to ```HCL module "fargate" { source = "strvcom/fargate/aws" - version = "0.17.1" + version = "0.17.0" name = "usage-example" # String, Required: this name will be used for many components of your infrastructure (vpc, loadbalancer, ecs cluster, etc...)