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 targeted replaces to update. #3418

Merged
merged 7 commits into from
Oct 31, 2019
Merged

Add targeted replaces to update. #3418

merged 7 commits into from
Oct 31, 2019

Conversation

pgavlin
Copy link
Member

@pgavlin pgavlin commented Oct 29, 2019

Allow the user to specify a set of resources to replace via the
--replace flag on the CLI. This can be combined with --target to
replace a specific set of resources without changing any other
resources.

Fixes #2643.

@pgavlin
Copy link
Member Author

pgavlin commented Oct 29, 2019

Working on tests now.

The only major question I have here is if we should have some shorthand for --target urn --replace urn.

if pe.stepGen != nil && pe.stepGen.creates != nil {
news = pe.stepGen.creates
if pe.stepGen != nil {
news = pe.stepGen.urns
Copy link
Member Author

Choose a reason for hiding this comment

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

This fixes a bug that caused a "resource not found" error if a specified target was replaced rather than created or updated.

cmd/up.go Show resolved Hide resolved
Allow the user to specify a set of resources to replace via the
`--replace` flag on the CLI. This can be combined with `--target` to
replace a specific set of resources without changing any other
resources.

Fixes #2643.
This flag treats --replace urn as if it also implies --target urn.
Copy link
Member

@lukehoban lukehoban left a comment

Choose a reason for hiding this comment

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

LGTM

`--replace urn` argument. Multiple resources can be specified using `--replace urn1 --replace urn2`. In order to
replace exactly one resource, invoke `pulumi update --replace urn --target urn`. In order to treat all resources
mentioned by `--replace` as if they were also passed via `--target`, pass the `--target-replaces` flag.
[#3418](https://github.com/pulumi/pulumi/pull/3418)
Copy link
Member

Choose a reason for hiding this comment

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

This is no longer correct, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, correct--will fix.

@pgavlin pgavlin merged commit 23a84df into master Oct 31, 2019
@pulumi-bot pulumi-bot deleted the pgavlin/replace branch October 31, 2019 00:16
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.

Support marking a resource for replacement
2 participants