Hello again, any reason this: ```new aws.iam.RoleP...
# aws
g
Hello again, any reason this:
Copy code
new aws.iam.RolePolicy(
        pulumi.interpolate`${this.service.taskDefinition.executionRole.name}-ssm-policy`,
        {
might be giving this error? Argument of type ‘Output<string>’ is not assignable to parameter of type ‘string’
1
l
Yep. The 1st parameter is the resource name in Pulumi's state. It's needed at runtime.
pulumi.interpolate
generates an output, which does not resolve until deploy time... which might finish many minutes (or longer) after runtime.
You can't use an output as a resource name. You can use an output to name the in-cloud resource, but you can't use it to name the resource within Pulumi's state.
While it is possible to work around this by creating the resource inside an apply() (when Pulumi can wait on the the
pulumi.interpolate
to complete), this is best avoided. You should use a name that is not dependent on an output.
In this case, is the value that you provided when setting up
this.service.taskDefinition.executionRole.name
known? If it is, then use that value directly, instead of from the Pulumi resource's outputs.
g
Oh ok, I didnt know it want recommended to use names based on resource names. How would be the recommended way to associate those resources by name if Pulumi is the one generating them?
l
Don't use a Pulumi-generated name. Maybe use the name you gave to the source resource? Reusing names is a good idea: the only place you see those names is in the Pulumi graph and URNs, which also have the type string, so easily distinguishable.
E.g. when I create a component resource called "devs", then almost all the resources it creates are called "devs". Unless I'm creating more than 1 of a given type, then they're called "devs-${index}".
g
Awesome, thanks for the detailed and quick reponse, truly appreciate it. Another question, how can one use the AWS account ID?
l
Do you mean, get at it to use it? Pretty sure there's a function in the top level of the pulumi-aws package for that. If not, then there'll be something in the sts package. Not at computer right now to look it up :(
👍 1