Hi, I'm following the example code in the docs for...
# dotnet
f
Hi, I'm following the example code in the docs for
tranformations
at https://www.pulumi.com/docs/intro/concepts/programming-model/#transformations and I'm finding that ResourceOptions.Merge doesn't seem to be available - I wondered if anyone had any pointers on this? Thanks!
Copy code
var vpc = new MyVpcComponent("vpc", new ComponentResourceOptions
{
    Transformations =
    {
        args =>
        {
            if (args.Resource.GetResourceType() == "aws:ec2/vpc:Vpc" ||
                args.Resource.GetResourceType() === "aws:ec2/subnet:Subnet")
            {
                return new ResourceTransformationResult
                {
                    Args: args.Args,
                    Options: ResourceOptions.Merge( // Not available
                        args.Options,
                        new CustomResourceOptions { IgnoreChanges =  { "tags" } }),
                };
            }

            return null;
        }
    },
});
f
It should exist on the concrete type, e.g.
CustomResourceOptions
or
ComponentResourceOptions
depending on which type of resource it is
f
Thanks @faint-table-42725
Copy code
ResourceTransformationArgs.Options
is a ResourceOptions whereas
Copy code
CustomResourceOptions.Merge
takes CustomResourceOptions Would you suggest creating a CustomResourceOptions based on the ResourceOptions from ResourceTransformationArgs.Options?
I haven't spotted part of the public API to convert ResourceOptions into CustomResourceOptions
t
Copy code
if (options is CustomResourceOptions customOptions)
{
  customOptions.Merge(…);
}
something like this?