Skip to content

Commit

Permalink
Update aws templates to be terraform v15 compliant
Browse files Browse the repository at this point in the history
- This adds a '=' to each "tags" block as required by aws provider
- This adds a "required_providers" block as recommended by terraform
  deprecation warning
- This removes quotes from the types for variables as required by
  terraform v15
- This removes quotes from arrays as recommended by terraform
  deprecation warning

Signed-off-by: Neil Hickey <nhickey@vmware.com>
  • Loading branch information
neil-hickey authored and gbandres98 committed Jul 16, 2021
1 parent b7270ca commit d0ceb71
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 65 deletions.
45 changes: 26 additions & 19 deletions terraform/aws/templates/base.tf
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 3.49"
}
tls = {
source = "hashicorp/tls"
version = ">= 3.1"
}
}
}

provider "aws" {
access_key = "${var.access_key}"
secret_key = "${var.secret_key}"
region = "${var.region}"

version = "~> 1.60"
}

provider "tls" {
version = "~> 1.2"
}

variable "access_key" {
Expand All @@ -27,7 +34,7 @@ variable "bosh_inbound_cidr" {
}

variable "availability_zones" {
type = "list"
type = list
}

variable "env_id" {
Expand All @@ -44,7 +51,7 @@ variable "vpc_cidr" {
}

resource "aws_eip" "jumpbox_eip" {
depends_on = ["aws_internet_gateway.ig"]
depends_on = [aws_internet_gateway.ig]
vpc = true
}

Expand All @@ -63,7 +70,7 @@ resource "aws_security_group" "nat_security_group" {
description = "NAT"
vpc_id = "${local.vpc_id}"

tags {
tags = {
Name = "${var.env_id}-nat-security-group"
}

Expand Down Expand Up @@ -116,7 +123,7 @@ resource "aws_nat_gateway" "nat" {
subnet_id = "${aws_subnet.bosh_subnet.id}"
allocation_id = "${aws_eip.nat_eip.id}"

tags {
tags = {
Name = "${var.env_id}-nat"
EnvID = "${var.env_id}"
}
Expand All @@ -125,7 +132,7 @@ resource "aws_nat_gateway" "nat" {
resource "aws_eip" "nat_eip" {
vpc = true

tags {
tags = {
Name = "${var.env_id}-nat"
EnvID = "${var.env_id}"
}
Expand All @@ -140,12 +147,12 @@ resource "aws_security_group" "internal_security_group" {
description = "Internal"
vpc_id = "${local.vpc_id}"

tags {
tags = {
Name = "${var.env_id}-internal-security-group"
}

lifecycle {
ignore_changes = ["name"]
ignore_changes = [name]
}
}

Expand Down Expand Up @@ -199,12 +206,12 @@ resource "aws_security_group" "bosh_security_group" {
description = "BOSH Director"
vpc_id = "${local.vpc_id}"

tags {
tags = {
Name = "${var.env_id}-bosh-security-group"
}

lifecycle {
ignore_changes = ["name", "description"]
ignore_changes = [name, description]
}
}

Expand Down Expand Up @@ -285,12 +292,12 @@ resource "aws_security_group" "jumpbox" {
description = "Jumpbox"
vpc_id = "${local.vpc_id}"

tags {
tags = {
Name = "${var.env_id}-jumpbox-security-group"
}

lifecycle {
ignore_changes = ["name", "description"]
ignore_changes = [name, description]
}
}

Expand Down Expand Up @@ -361,7 +368,7 @@ resource "aws_subnet" "bosh_subnet" {
vpc_id = "${local.vpc_id}"
cidr_block = "${cidrsubnet(var.vpc_cidr, 8, 0)}"

tags {
tags = {
Name = "${var.env_id}-bosh-subnet"
}
}
Expand All @@ -387,7 +394,7 @@ resource "aws_subnet" "internal_subnets" {
cidr_block = "${cidrsubnet(var.vpc_cidr, 4, count.index+1)}"
availability_zone = "${element(var.availability_zones, count.index)}"

tags {
tags = {
Name = "${var.env_id}-internal-subnet${count.index}"
}

Expand Down
2 changes: 1 addition & 1 deletion terraform/aws/templates/cf_dns.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ resource "aws_route53_zone" "env_dns_zone" {

name = "${var.system_domain}"

tags {
tags = {
Name = "${var.env_id}-hosted-zone"
}
}
Expand Down
32 changes: 16 additions & 16 deletions terraform/aws/templates/cf_lb.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ resource "aws_security_group" "cf_ssh_lb_security_group" {
cidr_blocks = ["0.0.0.0/0"]
}

tags {
tags = {
Name = "${var.env_id}-cf-ssh-lb-security-group"
}

lifecycle {
ignore_changes = ["name"]
ignore_changes = [name]
}
}

Expand All @@ -49,12 +49,12 @@ resource "aws_security_group" "cf_ssh_lb_internal_security_group" {
cidr_blocks = ["0.0.0.0/0"]
}

tags {
tags = {
Name = "${var.env_id}-cf-ssh-lb-internal-security-group"
}

lifecycle {
ignore_changes = ["name"]
ignore_changes = [name]
}
}

Expand Down Expand Up @@ -84,7 +84,7 @@ resource "aws_elb" "cf_ssh_lb" {
security_groups = ["${aws_security_group.cf_ssh_lb_security_group.id}"]
subnets = ["${aws_subnet.lb_subnets.*.id}"]

tags {
tags = {
Name = "${var.env_id}"
}
}
Expand Down Expand Up @@ -130,12 +130,12 @@ resource "aws_security_group" "cf_router_lb_security_group" {
cidr_blocks = ["0.0.0.0/0"]
}

tags {
tags = {
Name = "${var.env_id}-cf-router-lb-security-group"
}

lifecycle {
ignore_changes = ["name"]
ignore_changes = [name]
}
}

Expand All @@ -162,12 +162,12 @@ resource "aws_security_group" "cf_router_lb_internal_security_group" {
cidr_blocks = ["0.0.0.0/0"]
}

tags {
tags = {
Name = "${var.env_id}-cf-router-lb-internal-security-group"
}

lifecycle {
ignore_changes = ["name"]
ignore_changes = [name]
}
}

Expand Down Expand Up @@ -213,7 +213,7 @@ resource "aws_elb" "cf_router_lb" {
security_groups = ["${aws_security_group.cf_router_lb_security_group.id}"]
subnets = ["${aws_subnet.lb_subnets.*.id}"]

tags {
tags = {
Name = "${var.env_id}"
}
}
Expand All @@ -228,7 +228,7 @@ resource "aws_lb_target_group" "cf_router_4443" {
protocol = "TCP"
}

tags {
tags = {
Name = "${var.env_id}"
}
}
Expand Down Expand Up @@ -260,12 +260,12 @@ resource "aws_security_group" "cf_tcp_lb_security_group" {
cidr_blocks = ["0.0.0.0/0"]
}

tags {
tags = {
Name = "${var.env_id}-cf-tcp-lb-security-group"
}

lifecycle {
ignore_changes = ["name"]
ignore_changes = [name]
}
}

Expand Down Expand Up @@ -299,12 +299,12 @@ resource "aws_security_group" "cf_tcp_lb_internal_security_group" {
cidr_blocks = ["0.0.0.0/0"]
}

tags {
tags = {
Name = "${var.env_id}-cf-tcp-lb-security-group"
}

lifecycle {
ignore_changes = ["name"]
ignore_changes = [name]
}
}

Expand Down Expand Up @@ -1027,7 +1027,7 @@ resource "aws_elb" "cf_tcp_lb" {
security_groups = ["${aws_security_group.cf_tcp_lb_security_group.id}"]
subnets = ["${aws_subnet.lb_subnets.*.id}"]

tags {
tags = {
Name = "${var.env_id}"
}
}
Expand Down
16 changes: 8 additions & 8 deletions terraform/aws/templates/concourse_lb.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ resource "aws_security_group" "concourse_lb_internal_security_group" {
description = "Concourse Internal"
vpc_id = "${local.vpc_id}"

tags {
tags = {
Name = "${var.env_id}-concourse-lb-internal-security-group"
}

lifecycle {
ignore_changes = ["name"]
ignore_changes = [name]
}
}

Expand Down Expand Up @@ -57,7 +57,7 @@ resource "aws_lb" "concourse_lb" {
load_balancer_type = "network"
subnets = ["${aws_subnet.lb_subnets.*.id}"]

tags {
tags = {
Name = "${var.env_id}"
}
}
Expand Down Expand Up @@ -86,7 +86,7 @@ resource "aws_lb_target_group" "concourse_lb_80" {
protocol = "TCP"
}

tags {
tags = {
Name = "${var.env_id}"
}
}
Expand All @@ -108,7 +108,7 @@ resource "aws_lb_target_group" "concourse_lb_2222" {
protocol = "TCP"
vpc_id = "${local.vpc_id}"

tags {
tags = {
Name = "${var.env_id}"
}
}
Expand All @@ -130,7 +130,7 @@ resource "aws_lb_target_group" "concourse_lb_443" {
protocol = "TCP"
vpc_id = "${local.vpc_id}"

tags {
tags = {
Name = "${var.env_id}"
}
}
Expand Down Expand Up @@ -172,7 +172,7 @@ resource "aws_lb_target_group" "concourse_lb_8844" {
protocol = "TCP"
vpc_id = "${local.vpc_id}"

tags {
tags = {
Name = "${var.env_id}"
}
}
Expand All @@ -194,7 +194,7 @@ resource "aws_lb_target_group" "concourse_lb_8443" {
protocol = "TCP"
vpc_id = "${local.vpc_id}"

tags {
tags = {
Name = "${var.env_id}"
}
}
Expand Down
Loading

0 comments on commit d0ceb71

Please sign in to comment.