Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Imagebuilder variable declarations missing (needed to access to parameterstore to create a valid AMI) #29

Open
youanden opened this issue Apr 2, 2022 · 1 comment
Labels
duplicate This issue or pull request already exists

Comments

@youanden
Copy link

youanden commented Apr 2, 2022

The imagebuilder/build.yml file references PARAMETERSTORE_NAME which isn't defined anywhere. Same for INSTANCE_NAME

I suggest making the following modifications.

build.yml:

_AWSTOKEN=$(curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 60")
PARAMETERSTORE_NAME=$(curl -s -H "X-aws-ec2-metadata-token: ${_AWSTOKEN}" http://169.254.169.254/latest/meta-data/tags/instance/Project)-env
_INSTANCE_NAME=$(curl -s -H "X-aws-ec2-metadata-token: ${_AWSTOKEN}" http://169.254.169.254/latest/meta-data/tags/instance/InstanceName)

(changes in the file referencing the name without the _)

imagebuilder.tf:

resource_tags = {
  Resource = "${local.project}-${each.key}-image"
  Project = "${local.project}"
  InstanceName = "${each.key}"
}

(using InstanceName instead of Name because it's reserved in resource_tags)

The launch templates already include the Project tag, so this would just ensure that the Build/Test EC2 instances include it for proper builds.

@youanden youanden changed the title Imagebuilder needs access to parameterstore to create a valid AMI Imagebuilder variable declarations missing (needed to access to parameterstore to create a valid AMI) Apr 3, 2022
@magenx magenx added the duplicate This issue or pull request already exists label Apr 3, 2022
@magenx
Copy link
Owner

magenx commented Apr 3, 2022

#30

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants