Add subnet_id parameter

This commit is contained in:
vvbogdanov87 2019-08-08 14:49:37 -07:00
parent f5e273d05c
commit b1114d9b87

View file

@ -59,12 +59,17 @@ function prepare_geny_aws() {
instance=$(get_value '.instance') instance=$(get_value '.instance')
ami=$(get_value '.AMI') ami=$(get_value '.AMI')
sg=$(get_value '.SG') sg=$(get_value '.SG')
subnet_id=$(get_value '.subnet_id')
if [[ $subnet_id == null ]]; then
subnet_id=""
fi
echo $region echo $region
echo $android_version echo $android_version
echo $instance echo $instance
echo $ami echo $ami
echo $sg echo $sg
echo $subnet_id
#TODO: remove this dirty hack #TODO: remove this dirty hack
if [[ $android_version == null ]]; then if [[ $android_version == null ]]; then
@ -183,6 +188,11 @@ variable "instance_type_$index" {
default = "$instance" default = "$instance"
} }
variable "subnet_id_$index" {
type = "string"
default = "$subnet_id"
}
provider "aws" { provider "aws" {
alias = "provider_$index" alias = "provider_$index"
region = "\${var.aws_region_$index}" region = "\${var.aws_region_$index}"
@ -214,6 +224,7 @@ resource "aws_instance" "geny_aws_$index" {
provider = "aws.provider_$index" provider = "aws.provider_$index"
ami="\${data.aws_ami.geny_aws_$index.id}" ami="\${data.aws_ami.geny_aws_$index.id}"
instance_type = "\${var.instance_type_$index}" instance_type = "\${var.instance_type_$index}"
subnet_id = "\${var.subnet_id_$index}"
vpc_security_group_ids=["\${aws_security_group.geny_sg_$index.name}"] vpc_security_group_ids=["\${aws_security_group.geny_sg_$index.name}"]
key_name = "\${aws_key_pair.geny_key_$index.key_name}" key_name = "\${aws_key_pair.geny_key_$index.key_name}"
tags { tags {