diff options
author | pmikus <pmikus@cisco.com> | 2021-10-06 12:53:37 +0000 |
---|---|---|
committer | Peter Mikus <pmikus@cisco.com> | 2021-10-14 10:31:56 +0000 |
commit | 4fa77cad3278e8e0736266dc52b4a5311a0d522d (patch) | |
tree | d0cf68fe89f608242307751970672917735cda85 /fdio.infra.terraform/2n_aws_c5n | |
parent | 4fddb82d1d5190ea348b573f75347c46426182fd (diff) |
feat(Packer): Introduce AMI packer images
Signed-off-by: pmikus <pmikus@cisco.com>
Change-Id: I471069fd4cc10a0627434a60b4627d1bd0e192b8
(cherry picked from commit 6f9f70d7bb1bbed37ff1495c20d11a03b82b9951)
Diffstat (limited to 'fdio.infra.terraform/2n_aws_c5n')
-rw-r--r-- | fdio.infra.terraform/2n_aws_c5n/deploy/main.tf | 96 | ||||
-rw-r--r-- | fdio.infra.terraform/2n_aws_c5n/deploy/variables.tf | 9 | ||||
-rw-r--r-- | fdio.infra.terraform/2n_aws_c5n/main.tf | 3 | ||||
-rw-r--r-- | fdio.infra.terraform/2n_aws_c5n/variables.tf | 18 |
4 files changed, 73 insertions, 53 deletions
diff --git a/fdio.infra.terraform/2n_aws_c5n/deploy/main.tf b/fdio.infra.terraform/2n_aws_c5n/deploy/main.tf index 1ea7e50152..db1463e788 100644 --- a/fdio.infra.terraform/2n_aws_c5n/deploy/main.tf +++ b/fdio.infra.terraform/2n_aws_c5n/deploy/main.tf @@ -220,7 +220,7 @@ data "aws_network_interface" "tg_if2" { # Instances resource "aws_instance" "tg" { depends_on = [aws_vpc.CSITVPC, aws_placement_group.CSITPG] - ami = var.ami_image + ami = var.ami_image_tg availability_zone = var.avail_zone instance_initiated_shutdown_behavior = var.instance_initiated_shutdown_behavior instance_type = var.instance_type @@ -245,7 +245,7 @@ resource "aws_instance" "tg" { resource "aws_instance" "dut1" { depends_on = [aws_vpc.CSITVPC, aws_placement_group.CSITPG, aws_instance.tg] - ami = var.ami_image + ami = var.ami_image_sut availability_zone = var.avail_zone instance_initiated_shutdown_behavior = var.instance_initiated_shutdown_behavior instance_type = var.instance_type @@ -307,29 +307,29 @@ resource "null_resource" "deploy_tg" { private_key = tls_private_key.CSITTLS.private_key_pem } - provisioner "remote-exec" { - inline = var.first_run_commands - } - - provisioner "ansible" { - plays { - playbook { - file_path = var.ansible_file_path - force_handlers = true - } - hosts = ["tg_aws"] - extra_vars = { - ansible_ssh_pass = var.ansible_provision_pwd - ansible_python_interpreter = var.ansible_python_executable - aws = true - } - } - } - - provisioner "remote-exec" { - on_failure = continue - inline = ["sudo reboot"] - } +# provisioner "remote-exec" { +# inline = var.first_run_commands +# } +# +# provisioner "ansible" { +# plays { +# playbook { +# file_path = var.ansible_file_path +# force_handlers = true +# } +# hosts = ["tg_aws"] +# extra_vars = { +# ansible_ssh_pass = var.ansible_provision_pwd +# ansible_python_interpreter = var.ansible_python_executable +# aws = true +# } +# } +# } +# +# provisioner "remote-exec" { +# on_failure = continue +# inline = ["sudo reboot"] +# } } resource "null_resource" "deploy_dut1" { @@ -348,29 +348,29 @@ resource "null_resource" "deploy_dut1" { private_key = tls_private_key.CSITTLS.private_key_pem } - provisioner "remote-exec" { - inline = var.first_run_commands - } - - provisioner "ansible" { - plays { - playbook { - file_path = var.ansible_file_path - force_handlers = true - } - hosts = ["sut_aws"] - extra_vars = { - ansible_ssh_pass = var.ansible_provision_pwd - ansible_python_interpreter = var.ansible_python_executable - aws = true - } - } - } - - provisioner "remote-exec" { - on_failure = continue - inline = ["sudo reboot"] - } +# provisioner "remote-exec" { +# inline = var.first_run_commands +# } +# +# provisioner "ansible" { +# plays { +# playbook { +# file_path = var.ansible_file_path +# force_handlers = true +# } +# hosts = ["sut_aws"] +# extra_vars = { +# ansible_ssh_pass = var.ansible_provision_pwd +# ansible_python_interpreter = var.ansible_python_executable +# aws = true +# } +# } +# } +# +# provisioner "remote-exec" { +# on_failure = continue +# inline = ["sudo reboot"] +# } } resource "null_resource" "deploy_topology" { diff --git a/fdio.infra.terraform/2n_aws_c5n/deploy/variables.tf b/fdio.infra.terraform/2n_aws_c5n/deploy/variables.tf index 6e9ffd183d..57c5b69f8e 100644 --- a/fdio.infra.terraform/2n_aws_c5n/deploy/variables.tf +++ b/fdio.infra.terraform/2n_aws_c5n/deploy/variables.tf @@ -7,8 +7,13 @@ variable "vault-name" { default = "dynamic-aws-creds-vault-admin" } -variable "ami_image" { - description = "AWS AMI image name" +variable "ami_image_tg" { + description = "AWS AMI image name for TG" + type = string +} + +variable "ami_image_sut" { + description = "AWS AMI image name for SUT" type = string } diff --git a/fdio.infra.terraform/2n_aws_c5n/main.tf b/fdio.infra.terraform/2n_aws_c5n/main.tf index 44ec177e99..45b597de75 100644 --- a/fdio.infra.terraform/2n_aws_c5n/main.tf +++ b/fdio.infra.terraform/2n_aws_c5n/main.tf @@ -13,7 +13,8 @@ module "deploy" { region = var.region avail_zone = var.avail_zone instance_type = var.instance_type - ami_image = var.ami_image + ami_image_tg = var.ami_image_tg + ami_image_sut = var.ami_image_sut # AWS Network vpc_cidr_mgmt = "192.168.0.0/24" diff --git a/fdio.infra.terraform/2n_aws_c5n/variables.tf b/fdio.infra.terraform/2n_aws_c5n/variables.tf index c3d81bfbcc..62a7de4c57 100644 --- a/fdio.infra.terraform/2n_aws_c5n/variables.tf +++ b/fdio.infra.terraform/2n_aws_c5n/variables.tf @@ -14,12 +14,26 @@ variable "avail_zone" { default = "eu-central-1a" } -variable "ami_image" { +variable "ami_image_tg" { # eu-central-1/focal-20.04-amd64-hvm-ssd-20210119.1 # kernel 5.4.0-1035-aws (~5.4.0-65) description = "AWS AMI image ID" type = string - default = "ami-0a875db8a031a9efb" + default = "ami-0d6bc0344dc036b9d" +} + +variable "ami_image_sut" { + # eu-central-1/focal-20.04-amd64-hvm-ssd-20210119.1 + # kernel 5.4.0-1035-aws (~5.4.0-65) + description = "AWS AMI image ID" + type = string + default = "ami-012c9c631964367be" +} + +variable "instance_initiated_shutdown_behavior" { + description = "Shutdown behavior for the instance" + type = string + default = "terminate" } variable "instance_type" { |