The AWS AMI I am runnig for the past 1/2 year isn'...
# aws
g
The AWS AMI I am runnig for the past 1/2 year isn't found via aws.ec2.Instance(...) during a pulumi preview. I know the ami string is absolutely valid, but is no longer present on the AWS marketplace. error: Error: invocation of awsec2/getAmigetAmi returned an error: invoking awsec2/getAmigetAmi: 1 error occurred: * Your query returned no results. Please change your search criteria and try again. Do I just try/catch this error so that
pulumi preview
succeeds? This seems very hacky
l
If the AMI no longer exists, then do you really want to try/catch the error? Don't you want to update the AMI to something that does exist?
g
@little-cartoon-10569 - updating the AMI would completely destroy my staging or production EC2s, so definitely NOT! The better solution can be found @ https://app.slack.com/client/T85C88L30/CRH5ENVDX Thanks for your response. -- L
l
That link doesn't work for me.
s
You could do an
ignoreChanges
on the AMI property of the EC2 instance: https://www.pulumi.com/docs/concepts/options/ignorechanges/ This would let you get past the missing AMI error (for now), but it’s still something you’ll need to address at some point.
l
And you could avoid getAmi, and just hard-code the AMI id.
s
Or provide the AMI ID as a configuration value to the stack. 🙂