Giter VIP home page Giter VIP logo

Comments (6)

Frassle avatar Frassle commented on May 30, 2024 1

take the original inputs returned by Read and continue with them to create a Pulumi program

This is already what we do. The reason we warn about the check failures is that the first time you run up with those inputs you'll also get check failures, and those will be a hard error not just a warning.

Warn the user that the program will need manual edits before it can succeed in the next pulumi up.

We could probably make this more clear in the warning message.

attempt to generate a minimum set of inputs

Checking the code I think there is capacity to improve things here. Although I think it'll be on the providers to improve things. We use Read for both import and refresh but importantly for import we don't pass any old inputs/state so the provider can tell the difference between an "import Read" and "refresh Read". When doing an import Read we only need the minimal set of inputs to generate the program, we don't need the full set of inputs to build correct state.

So the provider can probably do a cleanup pass on the inputs returned from the TF provider to fit what's needed for the program. Stuff like optional fields not set, conflict fields that TF says are null, etc.

from pulumi.

justinvp avatar justinvp commented on May 30, 2024

Very interesting idea! We are planning some improvements for import this quarter and this may be worth considering as part of that. cc: @Zaid-Ajaj, @Frassle

from pulumi.

t0yv0 avatar t0yv0 commented on May 30, 2024

Ah actually you are right, I was moving too fast.

The example reads as this:

  aws:ec2:Subnet (import-subnet-edfe0bb0):
    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/subnet:Subnet resource 'import-subnet-edfe0bb0' has a problem: Conflicting configuration arguments: "availability_zone": conflicts with availability_zone_id. Examine values at 'Subnet.AvailabilityZone'.
    warning: aws:ec2/subnet:Subnet resource 'import-subnet-edfe0bb0' has a problem: Conflicting configuration arguments: "availability_zone_id": conflicts with availability_zone. Examine values at 'Subnet.AvailabilityZoneId'.

So it does no block the user but it does commit us to fix this in the provider, which we will not be able to do for all cases as TF does not consider this behavior a bug, so projecting TF to bridged providers, especially build-less providers, will always emit this, I think we need to soften the language here in the warning.

We will fix it for subnet but not sure yet if we can comprehensively fix it for all.

from pulumi.

t0yv0 avatar t0yv0 commented on May 30, 2024

We already use a heuristic to decide if a Read is a refresh Read or Import Read indeed:

https://github.com/pulumi/pulumi-terraform-bridge/blob/master/pkg/tfbridge/provider.go#L1188

from pulumi.

pulumi-bot avatar pulumi-bot commented on May 30, 2024

Cannot close issue:

  • does not have required labels: resolution/

Please fix these problems and try again.

from pulumi.

t0yv0 avatar t0yv0 commented on May 30, 2024

Will continue in pulumi/pulumi-terraform-bridge#1225

from pulumi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.