-
Notifications
You must be signed in to change notification settings - Fork 152
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
Importing a subnet gives a warning #2318
Comments
import * as aws from "@pulumi/aws";
const mainVpc = new aws.ec2.Vpc("main", {cidrBlock: "10.0.0.0/16"});
const example = new aws.ec2.Subnet("in_secondary_cidr", {
vpcId: mainVpc.id,
cidrBlock: "10.0.0.0/24",
});
export const exampleId = example.id; Now:
From the log:
|
This sets availability_zone and availability_zone_in Read: This specifies the conflict: |
Both attributes seem to be Optional+Computed meaning that they can be set by either the provider or the user, and Pulumi maps them to inputs and outputs. |
Curious how this works in Terraform proper, checking. |
Looks like in TF there are no warnings on import but https://spacelift.io/blog/importing-exisiting-infrastructure-into-terraform is suggesting to manually edit the program at which point this issue can be manually resolved . |
Toward #1225 - this fixes the special case of ConflictsWith warnings. This fixes spurious warnings on `pulumi import`, popular bugs such as: - pulumi/pulumi-aws#2318 - pulumi/pulumi-aws#3670 - pulumi/pulumi-gitlab#293 - pulumi/pulumi-gcp#844 - pulumi/pulumi-linode#373 TF does not guarantee Read results to be compatible with calling Check on, in particular Read can return results that run afoul of ConflictsWith constraint. This change compensates by arbitrarily dropping data from the Read result until it passes ConflictsWith checks. This affects `pulumi refresh` as well as I think it should although I have not seen "in the wild" cases where refresh is affected, since it typically will not copy these properties to the input bag unless they're present in old inputs, which are usually correct wrt to ConflictsWith.
@t0yv0 I checked whether this was fixed by the bridge upgrade #3929 to 3.82.0, but it's still occurring on
|
Thanks so much for checking @flostadler Unfortunately it appears there was a slight versioning error so that the bridge fix is not made available yet for AWS. This issue should resolve itself on the next bridge release and automated round of upgrades.
|
This should be fixed by #3984 pulling in https://github.com/pulumi/pulumi-terraform-bridge/releases/tag/v3.83.0 I will cut a new release. |
This issue is fixed in v6.37.1. Example: Importing (dev)
View in Browser (Ctrl+O): https://app.pulumi.com/anton-pulumi-corp/aws-2318/dev/updates/36
Type Name Status
+ pulumi:pulumi:Stack aws-2318-dev created (2s)
= └─ aws:ec2:Subnet mynewsubnet imported (0.42s)
Resources:
+ 1 created
= 1 imported
2 changes
Duration: 3s
Please copy the following code into your Pulumi application. Not doing so
will cause Pulumi to report that an update will happen on the next update command.
Please note that the imported resources are marked as protected. To destroy them
you will need to remove the `protect` option and run `pulumi update` *before*
the destroy will take effect.
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const mynewsubnet = new aws.ec2.Subnet("mynewsubnet", {
availabilityZone: "us-east-1d",
cidrBlock: "10.0.0.0/24",
privateDnsHostnameTypeOnLaunch: "ip-name",
vpcId: "vpc-088588305ca732419",
}, {
protect: true,
}); The provider is picking availabilityZone and dropping availabilityZoneId from the read result to avoid the warning. |
What happened?
When importing an
aws.ec2.Subnet
, I get the following warning:Steps to reproduce
Run
pulumi import
on a subnet. Any subnet.Expected Behavior
No warning. I would suggest we favor the AZ over the AZID since the former is more frequently specified as an input.
Actual Behavior
Warning.
Output of
pulumi about
No response
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).
The text was updated successfully, but these errors were encountered: