Merge pull request #233 from clong/remove_tf_datasources

Remove Terraform Tag Based Datasources
This commit is contained in:
Chris Long
2019-03-26 17:07:44 +07:00
committed by GitHub
2 changed files with 13 additions and 51 deletions

View File

@@ -26,7 +26,7 @@ resource "aws_route" "internet_access" {
resource "aws_subnet" "default" {
vpc_id = "${aws_vpc.default.id}"
cidr_block = "192.168.38.0/24"
availability_zone = "${var.availability_zone}"
availability_zone = "${var.availability_zone}"
map_public_ip_on_launch = true
}
@@ -190,7 +190,7 @@ resource "aws_instance" "logger" {
resource "aws_instance" "dc" {
instance_type = "t2.medium"
ami = "${data.aws_ami.dc_ami.image_id}"
ami = "${var.dc_ami}"
tags {
Name = "dc.windomain.local"
}
@@ -204,7 +204,7 @@ resource "aws_instance" "dc" {
resource "aws_instance" "wef" {
instance_type = "t2.medium"
ami = "${data.aws_ami.wef_ami.image_id}"
ami = "${var.wef_ami}"
tags {
Name = "wef.windomain.local"
}
@@ -218,7 +218,7 @@ resource "aws_instance" "wef" {
resource "aws_instance" "win10" {
instance_type = "t2.medium"
ami = "${data.aws_ami.win10_ami.image_id}"
ami = "${var.win10_ami}"
tags {
Name = "win10.windomain.local"
}

View File

@@ -35,60 +35,22 @@ variable "external_dns_servers" {
default = ["8.8.8.8"]
}
# The logger host will provision itself and does not use a pre-built AMI
# Use Data Sources to resolve the AMI-ID for the pre-built DC host
data "aws_ami" "dc_ami" {
owners = ["505638924199"]
filter {
name = "tag:Name"
values = ["dc"]
}
filter {
name = "image-id"
values = ["${var.dc_ami}"]
}
}
# Use Data Sources to resolve the AMI-ID for the pre-built WEF host
data "aws_ami" "wef_ami" {
owners = ["505638924199"]
most_recent = true
filter {
name = "tag:Name"
values = ["wef"]
}
filter {
name = "image-id"
values = ["${var.wef_ami}"]
}
}
# Use Data Sources to resolve the AMI-ID for the pre-built Win10 host
data "aws_ami" "win10_ami" {
owners = ["505638924199"]
most_recent = true
filter {
name = "tag:Name"
values = ["win10"]
}
filter {
name = "image-id"
values = ["${var.win10_ami}"]
}
}
# The logger host uses the Amazon Ubuntu 16.04 image
# If you are building your own AMIs, replace the default values below with
# the AMI IDs
variable "logger_ami" {
default = "*"
type = "string"
default = "ami-0693b32d066fade8a"
}
variable "dc_ami" {
default = "*"
type = "string"
default = "ami-0fcdb93aba16008ad"
}
variable "wef_ami" {
default = "*"
type = "string"
default = "ami-0bb08349b4ddd2816"
}
variable "win10_ami" {
default = "*"
type = "string"
default = "ami-00ae1022c8a735d81"
}