aboutsummaryrefslogtreecommitdiffstats
path: root/fdio.infra.terraform/2n_aws_c5n/deploy
diff options
context:
space:
mode:
authorpmikus <pmikus@cisco.com>2021-08-11 09:55:22 +0000
committerpmikus <pmikus@cisco.com>2021-08-11 09:55:22 +0000
commit44784f12e7a1cfe42927bd301b90015ffa72b7d7 (patch)
treed6f702f9b5c79a81b076bc6d90c5287a4d256ade /fdio.infra.terraform/2n_aws_c5n/deploy
parent6de5c7fc4524c5121ed00dc2fa3ab34301d45215 (diff)
Infra: AWS self termination
Signed-off-by: pmikus <pmikus@cisco.com> Change-Id: I9ecd85d1086f6be1bbaf6a6925da362cc4c1a9ad
Diffstat (limited to 'fdio.infra.terraform/2n_aws_c5n/deploy')
-rw-r--r--fdio.infra.terraform/2n_aws_c5n/deploy/main.tf50
-rw-r--r--fdio.infra.terraform/2n_aws_c5n/deploy/variables.tf6
2 files changed, 32 insertions, 24 deletions
diff --git a/fdio.infra.terraform/2n_aws_c5n/deploy/main.tf b/fdio.infra.terraform/2n_aws_c5n/deploy/main.tf
index 95464fa177..8ab8311220 100644
--- a/fdio.infra.terraform/2n_aws_c5n/deploy/main.tf
+++ b/fdio.infra.terraform/2n_aws_c5n/deploy/main.tf
@@ -219,18 +219,19 @@ data "aws_network_interface" "tg_if2" {
# Instances
resource "aws_instance" "tg" {
- depends_on = [aws_vpc.CSITVPC, aws_placement_group.CSITPG]
- ami = var.ami_image
- availability_zone = var.avail_zone
- instance_type = var.instance_type
- key_name = aws_key_pair.CSITKP.key_name
- associate_public_ip_address = true
- subnet_id = aws_subnet.mgmt.id
- private_ip = var.tg_mgmt_ip
- vpc_security_group_ids = [aws_security_group.CSITSG.id]
- placement_group = aws_placement_group.CSITPG.id
- source_dest_check = false
- # host_id = "1"
+ depends_on = [aws_vpc.CSITVPC, aws_placement_group.CSITPG]
+ ami = var.ami_image
+ availability_zone = var.avail_zone
+ instance_initiated_shutdown_behavior = var.instance_initiated_shutdown_behavior
+ instance_type = var.instance_type
+ key_name = aws_key_pair.CSITKP.key_name
+ associate_public_ip_address = true
+ subnet_id = aws_subnet.mgmt.id
+ private_ip = var.tg_mgmt_ip
+ vpc_security_group_ids = [aws_security_group.CSITSG.id]
+ placement_group = aws_placement_group.CSITPG.id
+ source_dest_check = false
+ # host_id = "1"
root_block_device {
volume_size = 50
@@ -243,18 +244,19 @@ resource "aws_instance" "tg" {
}
resource "aws_instance" "dut1" {
- depends_on = [aws_vpc.CSITVPC, aws_placement_group.CSITPG, aws_instance.tg]
- ami = var.ami_image
- availability_zone = var.avail_zone
- instance_type = var.instance_type
- key_name = aws_key_pair.CSITKP.key_name
- associate_public_ip_address = true
- subnet_id = aws_subnet.mgmt.id
- private_ip = var.dut1_mgmt_ip
- vpc_security_group_ids = [aws_security_group.CSITSG.id]
- placement_group = aws_placement_group.CSITPG.id
- source_dest_check = false
- # host_id = "2"
+ depends_on = [aws_vpc.CSITVPC, aws_placement_group.CSITPG, aws_instance.tg]
+ ami = var.ami_image
+ availability_zone = var.avail_zone
+ instance_initiated_shutdown_behavior = var.instance_initiated_shutdown_behavior
+ instance_type = var.instance_type
+ key_name = aws_key_pair.CSITKP.key_name
+ associate_public_ip_address = true
+ subnet_id = aws_subnet.mgmt.id
+ private_ip = var.dut1_mgmt_ip
+ vpc_security_group_ids = [aws_security_group.CSITSG.id]
+ placement_group = aws_placement_group.CSITPG.id
+ source_dest_check = false
+ # host_id = "2"
root_block_device {
volume_size = 50
diff --git a/fdio.infra.terraform/2n_aws_c5n/deploy/variables.tf b/fdio.infra.terraform/2n_aws_c5n/deploy/variables.tf
index 429c5040de..9fa5a4da9e 100644
--- a/fdio.infra.terraform/2n_aws_c5n/deploy/variables.tf
+++ b/fdio.infra.terraform/2n_aws_c5n/deploy/variables.tf
@@ -17,6 +17,12 @@ variable "testbed_name" {
type = string
}
+variable "instance_initiated_shutdown_behavior" {
+ description = "Shutdown behavior for the instance"
+ type = string
+ default = "terminate"
+}
+
variable "instance_type" {
description = "AWS instance type"
type = string