Jelajahi Sumber

Fixes deprecated tf11 syntax that warns me all the time and bugs me

Fred Damstra 4 tahun lalu
induk
melakukan
9ffda87d44

+ 2 - 2
base/bastion/main.tf

@@ -165,7 +165,7 @@ module "public_dns_record" {
 
 data "template_file" "cloud-init" {
   # Should these be in a common directory? I suspect they'd be reusable
-  template = "${file("${path.module}/cloud-init/cloud-init.tpl")}"
+  template = file("${path.module}/cloud-init/cloud-init.tpl")
 
   vars = {
     hostname = var.instance_name
@@ -188,7 +188,7 @@ data "template_cloudinit_config" "cloud-init" {
   part {
     filename     = "init.cfg"
     content_type = "text/cloud-config"
-    content      = "${data.template_file.cloud-init.rendered}"
+    content      = data.template_file.cloud-init.rendered
   }
 
   # Additional parts as needed

+ 2 - 2
base/dns/resolver_instance/main.tf

@@ -82,7 +82,7 @@ module "public_dns_record" {
 
 data "template_file" "cloud-init" {
   # Should these be in a common directory? I suspect they'd be reusable
-  template = "${file("${path.module}/cloud-init/cloud-init.tpl")}"
+  template = file("${path.module}/cloud-init/cloud-init.tpl")
 
   vars = {
     hostname = local.instance_name
@@ -106,7 +106,7 @@ data "template_cloudinit_config" "cloud-init" {
   part {
     filename     = "init.cfg"
     content_type = "text/cloud-config"
-    content      = "${data.template_file.cloud-init.rendered}"
+    content      = data.template_file.cloud-init.rendered
   }
 
   # Additional parts as needed

+ 2 - 2
base/interconnects/cloud-init.tf

@@ -2,7 +2,7 @@ data "template_file" "cloud-init" {
   count = var.interconnects_count
 
   # Should these be in a common directory? I suspect they'd be reusable
-  template = "${file("${path.module}/cloud-init/cloud-init.tpl")}"
+  template = file("${path.module}/cloud-init/cloud-init.tpl")
 
   vars = {
     hostname = "interconnect-${count.index}"
@@ -27,7 +27,7 @@ data "template_cloudinit_config" "cloud-init" {
   part {
     filename     = "init.cfg"
     content_type = "text/cloud-config"
-    content      = "${data.template_file.cloud-init[count.index].rendered}"
+    content      = data.template_file.cloud-init[count.index].rendered
   }
 
   # Additional parts as needed

+ 1 - 1
base/mailrelay/main.tf

@@ -143,7 +143,7 @@ module "private_dns_record" {
 #The Cloud init data is to prepare the instance for use. 
 data "template_file" "cloud_init" {
   # Should these be in a common directory? I suspect they'd be reusable
-  template = "${file("${path.module}/cloud-init/cloud_init.tpl")}"
+  template = file("${path.module}/cloud-init/cloud_init.tpl")
 
   vars = {
     hostname = var.instance_name

+ 2 - 2
base/openvpn/main.tf

@@ -143,7 +143,7 @@ module "private_dns_record" {
 
 data "template_file" "cloud-init" {
   # Should these be in a common directory? I suspect they'd be reusable
-  template = "${file("${path.module}/cloud-init/cloud-init.tpl")}"
+  template = file("${path.module}/cloud-init/cloud-init.tpl")
 
   vars = {
     hostname = var.instance_name
@@ -166,7 +166,7 @@ data "template_cloudinit_config" "cloud-init" {
   part {
     filename     = "init.cfg"
     content_type = "text/cloud-config"
-    content      = "${data.template_file.cloud-init.rendered}"
+    content      = data.template_file.cloud-init.rendered
   }
 
   # Additional parts as needed

+ 2 - 2
base/proxy_server/main.tf

@@ -166,7 +166,7 @@ module "public_dns_record" {
 #The Cloud init data is to prepare the instance for use. 
 data "template_file" "cloud_init" {
   # Should these be in a common directory? I suspect they'd be reusable
-  template = "${file("${path.module}/cloud-init/cloud_init.tpl")}"
+  template = file("${path.module}/cloud-init/cloud_init.tpl")
 
   vars = {
     hostname = var.instance_name
@@ -189,7 +189,7 @@ data "template_cloudinit_config" "cloud_init_config" {
   part {
     filename     = "init.cfg"
     content_type = "text/cloud-config"
-    content      = "${data.template_file.cloud_init.rendered}"
+    content      = data.template_file.cloud_init.rendered
   }
 }
 

+ 2 - 2
base/qualys_scanners/ec2.tf

@@ -40,7 +40,7 @@ resource aws_instance "qualys_scanner_preauthorized" {
 
   ebs_optimized               = true
   vpc_security_group_ids      = [
-    "${module.qualys_scanner_sg.this_security_group_id}"
+    module.qualys_scanner_sg.this_security_group_id
   ]
 
   credit_specification {
@@ -70,7 +70,7 @@ resource aws_instance "qualys_scanner_standard" {
 
   ebs_optimized               = true
   vpc_security_group_ids      = [
-    "${module.qualys_scanner_sg.this_security_group_id}"
+    module.qualys_scanner_sg.this_security_group_id
   ]
 
   credit_specification {

+ 9 - 9
base/qualys_scanners/main.tf

@@ -5,15 +5,15 @@ data "aws_availability_zones" "available" {
 module "vpc" {
   source = "terraform-aws-modules/vpc/aws"
   version = "~> v2.0"
-  name = "${var.name}"
-  cidr = "${var.cidr}"
+  name = var.name
+  cidr = var.cidr
 
   azs = slice(data.aws_availability_zones.available.names,0,3)
 
   private_subnets = [
-      "${cidrsubnet(var.cidr,3,0)}",
-      "${cidrsubnet(var.cidr,3,1)}",
-      "${cidrsubnet(var.cidr,3,2)}",
+      cidrsubnet(var.cidr,3,0),
+      cidrsubnet(var.cidr,3,1),
+      cidrsubnet(var.cidr,3,2),
   ]
 
   # Potentially, we could route all accounts through the transit gateway to
@@ -24,9 +24,9 @@ module "vpc" {
   # or a /24 for each subnet (seems wasteful).
   #public_subnets = [ ]
   public_subnets = [
-      "${cidrsubnet(var.cidr,3,4)}",
-      "${cidrsubnet(var.cidr,3,5)}",
-      "${cidrsubnet(var.cidr,3,6)}",
+      cidrsubnet(var.cidr,3,4),
+      cidrsubnet(var.cidr,3,5),
+      cidrsubnet(var.cidr,3,6),
   ]
 
   enable_nat_gateway = true
@@ -34,7 +34,7 @@ module "vpc" {
 
   enable_ec2_endpoint              = true
   ec2_endpoint_private_dns_enabled = true
-  ec2_endpoint_security_group_ids  =  [ "${module.aws_endpoints_sg.this_security_group_id}" ]
+  ec2_endpoint_security_group_ids  =  [ module.aws_endpoints_sg.this_security_group_id ]
 
   dhcp_options_domain_name = var.dns_info["private"]["zone"]
 

+ 1 - 1
base/repo_server/main.tf

@@ -166,7 +166,7 @@ module "public_dns_record" {
 #The Cloud init data is to prepare the instance for use. 
 data "template_file" "cloud_init" {
   # Should these be in a common directory? I suspect they'd be reusable
-  template = "${file("${path.module}/cloud-init/cloud_init.tpl")}"
+  template = file("${path.module}/cloud-init/cloud_init.tpl")
 
   vars = {
     hostname = var.instance_name

+ 3 - 3
base/salt_master/main.tf

@@ -168,7 +168,7 @@ module "public_dns_record" {
 #prepopulating the salt master private key. May history judge me kindly.  
 data "template_file" "salt_master_cloud_init" {
   # Should these be in a common directory? I suspect they'd be reusable
-  template = "${file("${path.module}/cloud-init/cloud_init_salt_master.tpl")}"
+  template = file("${path.module}/cloud-init/cloud_init_salt_master.tpl")
 
   vars = {
     hostname = var.instance_name
@@ -192,13 +192,13 @@ data "template_cloudinit_config" "salt_master_cloud_init_config" {
   part {
     filename     = "init.cfg"
     content_type = "text/cloud-config"
-    content      = "${data.template_file.salt_master_cloud_init.rendered}"
+    content      = data.template_file.salt_master_cloud_init.rendered
   }
 
   # Additional parts as needed
   part {
     content_type = "text/x-shellscript"
-    content      = "${file("${path.module}/cloud-init/provision_salt_master.sh")}"
+    content      = file("${path.module}/cloud-init/provision_salt_master.sh")
   }
 }
 

+ 0 - 40
base/standard_vpc/security-groups.tf

@@ -22,30 +22,6 @@ module "aws_endpoints_sg" {
 }
 
 
-#TODO: Probably want this one available everywhere
-#module "vpc_default_security_groups" {
-#  source = "../modules/vpc_security_groups"
-#  version = "~> 2.17"
-#  name                   = "toolsvpc"
-#  tags                   = merge(var.standard_tags, var.tags)
-#  this_vpc               = "${module.vpc.vpc_id}"
-#
-#  ec2_prefix_list_count  = 1
-#  ec2_prefix_lists       = [ "${module.vpc.vpc_endpoint_s3_pl_id}" ]
-#  salt_masters_sg        = "${module.salt_masters_sg.this_security_group_id}"
-#  bastion_ssh_sg         = "${module.bastion_servers_sg.this_security_group_id}"
-#  proxy_servers_sg       = "${module.proxy_servers_sg.this_security_group_id}"
-#  sensu_servers_sg       = "${module.sensu_servers_sg.this_security_group_id}"
-#  repo_servers_sg        = "${module.repo_servers_sg.this_security_group_id}"
-#  idm_inbound_sg         = "${module.idm_inbound_sg.this_security_group_id}"
-#  openvpn_servers_sg     = "${module.openvpn_servers_sg.this_security_group_id}"
-#  phantom_servers_sg     = "${module.phantom_servers_sg.this_security_group_id}"
-#  mailrelay_sg           = "${module.mailrelay_sg.this_security_group_id}"
-#  moose_sg               = "${module.moose_inbound_sg.this_security_group_id}"
-#  vuln_scanner_sg_count = 1
-#  vuln_scanner_sgs      = [ "${module.vuln_scanners_sg.this_security_group_id}" ]
-#}
-
 # "Allow
 module "allow_all_from_trusted_sg" {
   use_name_prefix = false
@@ -72,22 +48,6 @@ module "allow_all_outbound_sg" {
   egress_rules = [ "all-all" ]
 }
 
-# TODO: Do we still want direct ssh as a standard SG? I think we want
-# to avoid this, so I'd say create it only with resources that need it.
-#module "ssh_all_sg" {
-#  use_name_prefix = false
-#  source = "terraform-aws-modules/security-group/aws"
-#  version = "~> 2.17"
-#  name        = "ssh-any"
-#  tags        = merge(var.standard_tags, var.tags)
-#  vpc_id      = "${module.vpc.vpc_id}"
-#
-#  ingress_cidr_blocks = "${local.ssh_jump_whitelist}"
-#
-#  egress_cidr_blocks = [ "0.0.0.0/0" ]
-#  ingress_rules = [ "ssh-tcp", "all-icmp" ]
-#}
-
 module "typical_host_security_group" {
   source = "../../submodules/security_group/typical_host"
 

+ 3 - 3
base/test_instance/main.tf

@@ -17,12 +17,12 @@ module "test_instance" {
   ebs_optimized          = true
   monitoring             = false # Do we use this?
 
-  user_data_base64 = "${data.template_cloudinit_config.cloud-init.rendered}"
+  user_data_base64 = data.template_cloudinit_config.cloud-init.rendered
 }
 
 data "template_file" "cloud-init" {
   # Should these be in a common directory? I suspect they'd be reusable
-  template = "${file("${path.module}/cloud-init/cloud-init.tpl")}"
+  template = file("${path.module}/cloud-init/cloud-init.tpl")
 
   vars = {
     hostname = "test_instance"
@@ -44,7 +44,7 @@ data "template_cloudinit_config" "cloud-init" {
   part {
     filename     = "init.cfg"
     content_type = "text/cloud-config"
-    content      = "${data.template_file.cloud-init.rendered}"
+    content      = data.template_file.cloud-init.rendered
   }
 
   # Additional parts as needed

+ 1 - 1
base/tfstate/tfstate-s3/outputs.tf

@@ -1,3 +1,3 @@
 output "lock_table_arn" {
-  value = "${aws_dynamodb_table.lock_table.arn}"
+  value = aws_dynamodb_table.lock_table.arn
 }

+ 4 - 4
base/vmray_instances/main.tf

@@ -45,7 +45,7 @@ module "vmray-server" {
   ebs_optimized          = true
   monitoring             = false # Do we use this?
 
-  user_data_base64 = "${data.template_cloudinit_config.cloud-init-vmray-server.rendered}"
+  user_data_base64 = data.template_cloudinit_config.cloud-init-vmray-server.rendered
 }
 
 #
@@ -67,13 +67,13 @@ module "vmray-worker" {
   ebs_optimized          = true
   monitoring             = false
 
-  #user_data_base64 = "${data.template_cloudinit_config.vmray-worker.*.rendered}"
+  #user_data_base64 = data.template_cloudinit_config.vmray-worker.*.rendered
 }
 
 
 data "template_file" "cloud-init-vmray-server" {
   # Should these be in a common directory? I suspect they'd be reusable
-  template = "${file("${path.module}/cloud-init/cloud-init.tpl")}"
+  template = file("${path.module}/cloud-init/cloud-init.tpl")
 
   vars = {
     hostname = "vmray_server"
@@ -92,7 +92,7 @@ data "template_cloudinit_config" "cloud-init-vmray-server" {
   part {
     filename     = "init.cfg"
     content_type = "text/cloud-config"
-    content      = "${data.template_file.cloud-init-vmray-server.rendered}"
+    content      = data.template_file.cloud-init-vmray-server.rendered
   }
 
   # Additional parts as needed