From 4ad6abebee828780a7bcf9b2cc9b7f82f43b9954 Mon Sep 17 00:00:00 2001 From: lolli001 Date: Fri, 12 Jul 2024 17:27:04 -0400 Subject: [PATCH] Intial Commit | Adding .yml --- main.tf | 14 ++++++++++++++ packer/rhel-arm.pkr.hcl | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 packer/rhel-arm.pkr.hcl diff --git a/main.tf b/main.tf index fa3d211..2e1c6c2 100644 --- a/main.tf +++ b/main.tf @@ -146,6 +146,20 @@ module "windows" { instance_type = "t2.xlarge" } +# Rhel pipeline testing - Braxton +module "arm_rhel_image_pipeline" { + source = "./packer" + source_repo_name = "aws-image-pipeline" + project_name = "arm-rhel-image-pipeline" + environment = "dev" + source_ami = "ami-0abcdef1234567890" # Specify a base RHEL ARM AMI ID + instance_type = "t4g.micro" # Example ARM instance type + ssh_username = "ec2-user" + playbook = "playbook.yml" + vpc_config = local.vpc_config + state_config = local.state_config +} + output iam_arn { value = module.main.iam_arn } diff --git a/packer/rhel-arm.pkr.hcl b/packer/rhel-arm.pkr.hcl new file mode 100644 index 0000000..dcbad04 --- /dev/null +++ b/packer/rhel-arm.pkr.hcl @@ -0,0 +1,37 @@ +packer { + required_plugins { + amazon = { + version = ">= 1.2.8" + source = "github.com/hashicorp/amazon" + } + ansible = { + version = ">= 1.1.1" + source = "github.com/hashicorp/ansible" + } + } +} + +variable "subnet_id" {} +variable "security_group_id" {} + +source "amazon-ebs" "rhel-arm" { + ami_name = "arm-rhel-image" + instance_type = "t4g.micro" + source_ami = "ami-xxx" # Need to change + ssh_username = "ec2-user" + subnet_id = var.subnet_id + security_group_ids = [ + var.security_group_id + ] + architecture = "arm64" +} + +build { + name = "arm-rhel-build" + sources = [ + "source.amazon-ebs.rhel-arm" + ] + provisioner "ansible" { + playbook_file = "../ansible/playbook.yml" + } +} \ No newline at end of file