From 116fc54f2e1b5f7d6c763532fb030b3a622eb9aa Mon Sep 17 00:00:00 2001 From: Ryan Malloy Date: Tue, 12 Nov 2024 18:15:34 +0000 Subject: [PATCH] Update packer-ami.pkr.hcl --- manager-ami.pkr.hcl => packer-ami.pkr.hcl | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) rename manager-ami.pkr.hcl => packer-ami.pkr.hcl (81%) diff --git a/manager-ami.pkr.hcl b/packer-ami.pkr.hcl similarity index 81% rename from manager-ami.pkr.hcl rename to packer-ami.pkr.hcl index 1575d8d..47ad4e9 100644 --- a/manager-ami.pkr.hcl +++ b/packer-ami.pkr.hcl @@ -6,14 +6,9 @@ packer { } } } - -variable "AWSAccessKeyID" {} -variable "AWSSecretAccessKey" {} - source "amazon-ebs" "ubuntu" { - ami_name = "gitlab-runner-manager-packer-ami" + ami_name = "packer-ami" instance_type = "t2.nano" - region = source_ami_filter { filters = { name = "ubuntu/images/*ubuntu-jammy-22.04-amd64-server-*" @@ -51,13 +46,21 @@ build { "mkdir ~/.aws" ] } + provisioner "file" { source = "aws-config" destination = "~/.aws/config" } + provisioner "file" { source = "aws-creds" destination = "~/.aws/credentials" } - + + provisioner "shell" { + inline = [ + "sed -i 's|aKeyID|${var.AWS_ACCESS_KEY_ID}|' ~/.aws/credentials", + "sed -i 's|aSecretAccessKey|${var.AWS_SECRET_ACCESS_KEY}|' ~/.aws/credentials" + ] + } } \ No newline at end of file