How do I get the input property of a resource in a...
# general
f
How do I get the input property of a resource in a transofmation in order to use it in the transformation function For example: I want to get the input property Name and Namespace from *helmv3.ReleaseArgs to add it as an option for puumi.Import()
Copy code
transformation := func(args *pulumi.ResourceTransformationArgs) *pulumi.ResourceTransformationResult {
  var id string
  switch args.Type {
    case "kubernetes:helm.sh/v3:Release":
      res := args.Props.(*helmv3.ReleaseArgs)
      # get the name and namespace here, how? convert stringPtrInput to string?
      # id = namespace/name
  }
  return &pulumi.ResourceTransformationResult{
       Props: args.Props,
	   Opts:  append(args.Opts, pulumi.Import(pulumi.ID(id))),
  }
}
l
It's in args.props.
You don't need to convert Inputs to strings. You either use apply if you need to change the value, or just the Input directly, if you don't.
I'm almost certain that you can't use a future value as an import ID. Import IDs are needed before the engine runs, future values aren't available until the engine is running. You can use the (Pulumi statue) name of the resource, which is available as args.name.