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

Add a --generate-code flag to import #9141

Merged
merged 5 commits into from
Mar 8, 2022
Merged

Add a --generate-code flag to import #9141

merged 5 commits into from
Mar 8, 2022

Conversation

Frassle
Copy link
Member

@Frassle Frassle commented Mar 8, 2022

Description

Adds a flag --generate-code to pulumi import. By default this is true, but users can pass --generate-code=false to skip the code generation step of import.

Fixes #9134

Checklist

  • I have added tests that prove my fix is effective or that my feature works
  • Yes, there are changes in this PR that warrants bumping the Pulumi Service API version

@Frassle Frassle requested review from iwahbe and Zaid-Ajaj March 8, 2022 11:59
Copy link
Member

@pgavlin pgavlin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two nits, LGTM otherwise. Thanks for turning this around so fast!

if err != nil {
return result.FromError(err)
}
if generateCode {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nit: maybe pull the body of this if out into its own function? Normally I'd suggest using an early return here to be more idiomatic and avoid the rightward movement, but that isn't convenient with the res != nil bits later.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd generally lean towards keeping the code inline here, we're just hitting 120 cols which doesn't seem unreasonable.

pkg/cmd/pulumi/import.go Outdated Show resolved Hide resolved
pkg/cmd/pulumi/import.go Outdated Show resolved Hide resolved
@iwahbe iwahbe self-requested a review March 8, 2022 17:18
@Frassle Frassle merged commit fb3f2bb into master Mar 8, 2022
@pulumi-bot pulumi-bot deleted the fraser/importNoCode branch March 8, 2022 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a flag to disable code generation to pulumi import
3 participants