pulumi-aws
pulumi-aws copied to clipboard
Cannot import EC2 launch template
What happened?
It's not possible to import EC2 launch template to Pulumi state due to validation errors.
Steps to reproduce
Following this guide, I tried to use pulumi import
which issued these warnings:
$ pulumi import aws:ec2/launchTemplate:LaunchTemplate internal-services lt-xxxxx
Previewing import (internal-services-dev):
Type Name Plan Info
pulumi:pulumi:Stack internal-services-internal-services-dev
= └─ aws:ec2:LaunchTemplate internal-services import 3
Diagnostics:
aws:ec2:LaunchTemplate (internal-services):
warning: One or more imported inputs failed to validate. This is almost certainly a bug in the `aws` provider. The import will still proceed, but you will need to edit the generated code after copying it into your program.
warning: aws:ec2/launchTemplate:LaunchTemplate resource 'internal-services' has a problem: expected metadata_options.0.http_protocol_ipv6 to be one of [disabled enabled], got . Examine values at 'LaunchTemplate.MetadataOptions.HttpProtocolIpv6'.
warning: aws:ec2/launchTemplate:LaunchTemplate resource 'internal-services' has a problem: expected metadata_options.0.instance_metadata_tags to be one of [disabled enabled], got . Examine values at 'LaunchTemplate.MetadataOptions.InstanceMetadataTags'.
Do you want to perform this import?
After copy/pasting the generated code into Pulumi program and running pulumi up
, I receive an error:
$ pulumi up
Previewing update (internal-services-dev):
Type Name Plan Info
pulumi:pulumi:Stack internal-services-internal-services-dev 1 err
= └─ aws:ec2:LaunchTemplate internal-services import 3
Diagnostics:
aws:ec2:LaunchTemplate (internal-services):
error: aws:ec2/launchTemplate:LaunchTemplate resource 'internal-services' has a problem: expected metadata_options.0.http_protocol_ipv6 to be one of [disabled enabled], got . Examine values at 'LaunchTemplate.MetadataOptions.HttpProtocolIpv6'.
error: aws:ec2/launchTemplate:LaunchTemplate resource 'internal-services' has a problem: expected metadata_options.0.instance_metadata_tags to be one of [disabled enabled], got . Examine values at 'LaunchTemplate.MetadataOptions.InstanceMetadataTags'.
error: Preview failed: one or more inputs failed to validate
error: preview failed
Expected Behavior
As there seems to be no option to specify the corresponding options in either AWS console nor using AWS CLI, I'd need to bypass the Pulumi checks for matching inputs with the existing resource's values (while specifying enabled/disabled for the corresponding metadata options) or disable validations using pulumi up (while leaving the metadata options empty to match the existing resource's values).
Actual Behavior
Pulumi either reports a validation error when using the generated code or reports an inputs mismatch with existing resource's options.
Versions used
CLI
Version 3.32.1
Go Version go1.17.9
Go Compiler gc
Plugins
NAME VERSION
aws 5.4.0
aws-tags 0.4.1
docker 3.2.0
python unknown
Host
OS ubuntu
Version 22.04
Arch x86_64
This project is written in python (/usr/bin/python3 v3.10.4)
Current Stack: internal-services-dev
...
<info about the stack resources omitted>
...
Backend
Name nyx
URL s3://xxx
User xxx
Organizations
NAME VERSION
pip 22.0.4
pulumi-aws-tags 0.4.1
pulumi-docker 3.2.0
setuptools 62.1.0
tldextract 3.3.0
wheel 0.37.1
Pulumi locates its logs in /tmp by default
Additional context
No response
Contributing
Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).
Just a quick addition. I can work around the issue by exporting the stack, changing the corresponding resource's inputs and outputs and importing the stack back.