Sfoglia il codice sorgente

Fixes Minor Issues with Interconnects

* Enables dynamic AMI use in order to upgrade to FIPS enabled AMI
* Moves the 'amis.tf' to a parent directory and changes modules to use
  symbolic link.
* Updates hostname of interconnects to use new DNS name

Should be tagged v0.6.6
Fred Damstra 5 anni fa
parent
commit
9e9393eca9

+ 89 - 0
base/amis.tf

@@ -0,0 +1,89 @@
+locals {
+  ami_map = {
+    "base"       = data.aws_ami.base.image_id,
+    "minion"     = data.aws_ami.minion.image_id,
+    "master"     = data.aws_ami.master.image_id,
+    #    "ubuntu1804" = data.aws_ami.ubuntu1804.image_id,
+  }
+}
+
+data "aws_ami" "base" {
+  most_recent = true
+  owners = [ var.common_services_account ]
+
+  filter {
+    name   = "virtualization-type"
+    values = ["hvm"]
+  }
+
+  filter {
+    name = "root-device-type"
+    values = ["ebs"]
+  }
+
+  filter {
+    name = "name"
+    values = [ "MSOC_RedHat_Base_*" ]
+  }
+}
+
+data "aws_ami" "minion" {
+  most_recent = true
+  owners = [ var.common_services_account ]
+
+  filter {
+    name   = "virtualization-type"
+    values = ["hvm"]
+  }
+
+  filter {
+    name = "root-device-type"
+    values = ["ebs"]
+  }
+
+  filter {
+    name = "name"
+    values = [ "MSOC_RedHat_Minion_*" ]
+  }
+}
+
+data "aws_ami" "master" {
+  most_recent = true
+  owners = [ var.common_services_account ]
+
+  filter {
+    name   = "virtualization-type"
+    values = ["hvm"]
+  }
+
+  filter {
+    name = "root-device-type"
+    values = ["ebs"]
+  }
+
+  filter {
+    name = "name"
+    values = [ "MSOC_RedHat_Master_*" ]
+  }
+}
+
+# not presently in commercial
+#data "aws_ami" "ubuntu1804" {
+#  most_recent = true
+#  owners = [ var.common_services_account ]
+#
+#  filter {
+#    name   = "virtualization-type"
+#    values = ["hvm"]
+#  }
+#
+#  filter {
+#    name = "root-device-type"
+#    values = ["ebs"]
+#  }
+#
+#  filter {
+#    name = "name"
+#    values = [ "MSOC_Ubuntu_1804_*" ]
+#  }
+#}

+ 1 - 0
base/interconnects/amis.tf

@@ -0,0 +1 @@
+../amis.tf

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

@@ -6,7 +6,7 @@ data "template_file" "cloud-init" {
 
   vars = {
     hostname = "interconnect-${count.index}"
-    fqdn = "interconnect-${count.index}.${var.dns_private["name"]}"
+    fqdn = "interconnect-${count.index}.${var.dns_info["private"]["zone"]}"
     saltmaster = "salt-master.${ var.dns_public["name"] }"
     environment = var.environment
     aws_partition = var.aws_partition

+ 1 - 2
base/interconnects/cloud-init/cloud-init.tpl

@@ -9,8 +9,7 @@ fqdn: ${fqdn}
 yum_repos:
   epel-release:
     baseurl: http://download.fedoraproject.org/pub/epel/7/$basearch
-    # TODO: Disable this by default
-    enabled: true
+    enabled: false
     failovermethod: priority
     gpgcheck: true
     gpgkey: http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7

+ 1 - 5
base/interconnects/main.tf

@@ -40,10 +40,6 @@ resource "aws_eip_association" "interconnects" {
   allocation_id = aws_eip.interconnects[count.index].id
 }
 
-output "ami" {
-  value = var.default_ami
-}
-
 resource "aws_instance" "interconnects" {
   count = var.interconnects_count
   availability_zone = var.azs[count.index % 2]
@@ -56,7 +52,7 @@ resource "aws_instance" "interconnects" {
   key_name = var.interconnects_key_name
   monitoring = false
 
-  ami = var.default_ami
+  ami = data.aws_ami.minion.id
   lifecycle { ignore_changes = [ ami, key_name, user_data ] }
 
   tags = merge(

+ 1 - 1
base/interconnects/vars.tf

@@ -20,8 +20,8 @@ variable "aws_region" { type = string }
 variable "aws_partition" { type = string }
 variable "aws_partition_alias" { type = string }
 variable "aws_account_id" { type = string }
-variable "default_ami" { type = string }
 variable "security_vpc_cidr" { type = string }
+variable "common_services_account" { type = string }
 
 # Legacy dns, remove this
 variable "dns_public" { type = map }

+ 0 - 89
base/test_instance/amis.tf

@@ -1,89 +0,0 @@
-locals {
-  ami_map = {
-    "base"       = data.aws_ami.base.image_id,
-    "minion"     = data.aws_ami.minion.image_id,
-    "master"     = data.aws_ami.master.image_id,
-    #    "ubuntu1804" = data.aws_ami.ubuntu1804.image_id,
-  }
-}
-
-data "aws_ami" "base" {
-  most_recent = true
-  owners = [ var.common_services_account ]
-
-  filter {
-    name   = "virtualization-type"
-    values = ["hvm"]
-  }
-
-  filter {
-    name = "root-device-type"
-    values = ["ebs"]
-  }
-
-  filter {
-    name = "name"
-    values = [ "MSOC_RedHat_Base_*" ]
-  }
-}
-
-data "aws_ami" "minion" {
-  most_recent = true
-  owners = [ var.common_services_account ]
-
-  filter {
-    name   = "virtualization-type"
-    values = ["hvm"]
-  }
-
-  filter {
-    name = "root-device-type"
-    values = ["ebs"]
-  }
-
-  filter {
-    name = "name"
-    values = [ "MSOC_RedHat_Minion_*" ]
-  }
-}
-
-data "aws_ami" "master" {
-  most_recent = true
-  owners = [ var.common_services_account ]
-
-  filter {
-    name   = "virtualization-type"
-    values = ["hvm"]
-  }
-
-  filter {
-    name = "root-device-type"
-    values = ["ebs"]
-  }
-
-  filter {
-    name = "name"
-    values = [ "MSOC_RedHat_Master_*" ]
-  }
-}
-
-# not presently in commercial
-#data "aws_ami" "ubuntu1804" {
-#  most_recent = true
-#  owners = [ var.common_services_account ]
-#
-#  filter {
-#    name   = "virtualization-type"
-#    values = ["hvm"]
-#  }
-#
-#  filter {
-#    name = "root-device-type"
-#    values = ["ebs"]
-#  }
-#
-#  filter {
-#    name = "name"
-#    values = [ "MSOC_Ubuntu_1804_*" ]
-#  }
-#}

+ 1 - 0
base/test_instance/amis.tf

@@ -0,0 +1 @@
+../amis.tf