diff --git a/base_images.tf b/base_images.tf new file mode 100644 index 0000000..ba6a94c --- /dev/null +++ b/base_images.tf @@ -0,0 +1,4 @@ +data aws_ssm_parameter "rhel9_ami" { + count = var.use_rhel9_ami ? 1 : 0 + name = "/enterprise/ami/rhel9" +} \ No newline at end of file diff --git a/morpheus.tf b/morpheus.tf index 3ec5e02..55e7af7 100644 --- a/morpheus.tf +++ b/morpheus.tf @@ -1,5 +1,5 @@ -data aws_ssm_parameter "rhel9_ami" { - name = "/enterprise/ami/rhel9" +locals { + morpheus_ami = "ami-04a32122e0bdbb20f" } module "morpheus" { @@ -23,6 +23,7 @@ module "morpheus" { name = aws_s3_bucket.assets_bucket.bucket key = "linux-image-pipeline.zip" } + packer_config = "morpheus-build.pkr.hcl" ansible_source_type = "S3" ansible_bucket = { name = aws_s3_bucket.assets_bucket.bucket @@ -38,7 +39,7 @@ module "morpheus" { state = local.state_config vpc_config = local.vpc_config ami = { - source_ami = data.aws_ssm_parameter.rhel9_ami.value + source_ami = var.use_rhel9_ami ? one(data.aws_ssm_parameter.rhel9_ami).value : local.morpheus_ami instance_type = "t3.micro" # x86_64 compatible instance type } } diff --git a/variables.tf b/variables.tf new file mode 100644 index 0000000..884103b --- /dev/null +++ b/variables.tf @@ -0,0 +1,5 @@ +variable use_rhel9_ami { + description = "Use RHEL 9 AMI" + type = bool + default = false +} \ No newline at end of file