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