Skip to content

Commit

Permalink
Update transformations page to include csharp example (#12187)
Browse files Browse the repository at this point in the history
  • Loading branch information
pierskarsenbarg authored Jul 14, 2024
1 parent f9b6b24 commit fea36cf
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion content/docs/concepts/options/transformations.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,22 @@ public class MyStack : Stack

private static ResourceTransformationResult? MyTransformation(ResourceTransformationArgs args)
{
// ...
var tagProperty = args.Args.GetType().GetProperty("Tags");
if (tagProperty != null) {
var currentResourceTags = (InputMap<string>)tagProperty.GetValue(args.Args, null) ?? new InputMap<string>();
currentResourceTags["env"] = "production";
tagProperty.SetValue(args.Args, currentResourceTags, null);
return new ResourceTransformationResult(args.Args, (CustomResourceOptions)args.Options);
}
return null;
}
}
```
{{% notes type="warning" %}}
It is not currently possible to use stack level transformations in .NET when using a top-level async program. We have an [open issue](https://github.com/pulumi/pulumi-dotnet/issues/202) regarding this feature that you can follow to find out more information.
{{% /notes %}}
{{% /choosable %}}
{{% choosable language java %}}
Expand Down

0 comments on commit fea36cf

Please sign in to comment.