Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade examples with newest TF version #54

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions examples/autoscaling/main.tf
Original file line number Diff line number Diff line change
@@ -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"
}
Expand All @@ -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
}
}
Expand Down
14 changes: 7 additions & 7 deletions examples/autoscaling/outputs.tf
Original file line number Diff line number Diff line change
@@ -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
}
4 changes: 2 additions & 2 deletions examples/basic/main.tf
Original file line number Diff line number Diff line change
@@ -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"
}
Expand Down
14 changes: 7 additions & 7 deletions examples/basic/outputs.tf
Original file line number Diff line number Diff line change
@@ -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
}
2 changes: 1 addition & 1 deletion examples/cross-sg-services/main.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# ⚠️ Only for TF version >=0.12

terraform {
required_version = "~> 0.12.0"
required_version = "~> 0.12"
}

provider "aws" {
Expand Down
14 changes: 7 additions & 7 deletions examples/cross-sg-services/outputs.tf
Original file line number Diff line number Diff line change
@@ -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
}
22 changes: 11 additions & 11 deletions examples/external_vpc/main.tf
Original file line number Diff line number Diff line change
@@ -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"
}
Expand All @@ -18,31 +18,31 @@ variable "private_subnets_cidrs" {

module "vpc" {
source = "terraform-aws-modules/vpc/aws"
version = "1.60.0"
version = "2.9.0"

create_vpc = true

name = "the-external-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" {
source = "../../"

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 = {
Expand Down
24 changes: 12 additions & 12 deletions examples/https_enabled/main.tf
Original file line number Diff line number Diff line change
@@ -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"
}
Expand All @@ -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
}
}
Expand All @@ -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
}
}
}
Expand Down
14 changes: 7 additions & 7 deletions examples/https_enabled/outputs.tf
Original file line number Diff line number Diff line change
@@ -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
}