tech.guitarrapc.cóm

Technical updates

Pulumi で特定のリソースのみUpdateやDestroyする

この記事は、Pulumi dotnet Advent Calendar 2019の21日目です。

https://qiita.com/advent-calendar/2019/pulumi-dotnet

Pulumiでterraform targetのような操作をどうやるか見てみます。

概要

Pulumi CLI 1.3.0から--targetによって可能になった。

合わせてreplaceにより入れ替えや、明示的な依存指示もサポートされている

--replace stringArray          Specify resources to replace. Multiple resources can be specified using --replace run1 --replace urn2
-t, --target stringArray           Specify a single resource URN to update. Other resources will not be updated. Multiple resources can be specified using --target urn1 --target urn2
--target-dependents            Allows updating of dependent targets discovered but not specified in --target list
--target-replace stringArray   Specify a single resource URN to replace. Other resources will not be updated. Shorthand for --target urn --replace urn.

実際に操作する

URNを調べる。

pulumi stack --show-urns

あとはURNを指定する。

pulumi up --target URN