aboutsummaryrefslogtreecommitdiffstats
path: root/fdio.infra.terraform/3n_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/3n_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/3n_aws_c5n/deploy')
-rw-r--r--fdio.infra.terraform/3n_aws_c5n/deploy/main.tf46
-rw-r--r--fdio.infra.terraform/3n_aws_c5n/deploy/variables.tf6
2 files changed, 30 insertions, 22 deletions
diff --git a/fdio.infra.terraform/3n_aws_c5n/deploy/main.tf b/fdio.infra.terraform/3n_aws_c5n/deploy/main.tf
index 3ca8758678..769aa59f1a 100644
--- a/fdio.infra.terraform/3n_aws_c5n/deploy/main.tf
+++ b/fdio.infra.terraform/3n_aws_c5n/deploy/main.tf
@@ -263,17 +263,18 @@ data "aws_network_interface" "tg_if2" {
# Instances
resource "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.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"
+ 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"
depends_on = [
aws_vpc.CSITVPC,
@@ -291,17 +292,18 @@ resource "aws_instance" "tg" {
}
resource "aws_instance" "dut1" {
- 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"
+ 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"
depends_on = [
aws_vpc.CSITVPC,
diff --git a/fdio.infra.terraform/3n_aws_c5n/deploy/variables.tf b/fdio.infra.terraform/3n_aws_c5n/deploy/variables.tf
index 97e986bb2f..f7f3e6189c 100644
--- a/fdio.infra.terraform/3n_aws_c5n/deploy/variables.tf
+++ b/fdio.infra.terraform/3n_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