sparse-intern-71089
07/17/2018, 4:33 AMcolossal-beach-47527
07/17/2018, 2:51 PM... = new aws.iam.InstanceProfile(`${baseName}-instance-profile`, ...
colossal-beach-47527
07/17/2018, 2:53 PM${baseName}-instance-profile-12345
. This however means that you cannot use the same “pulumi name” for another resource, as it woudl lead to a conflict. So if you created another resource — even with a different type — with ${baseName}-instance-profile
, you would get an error.
In your code this is probably just fine, since you are including the ${baseName}
variable.colossal-beach-47527
07/17/2018, 2:54 PM${baseName}-instance-profile
as well? And must that name be unique within the same AWS account, or globally across all accounts?
e.g. in AWS S3 bucket names must be globally unique. Many resource names must be unique within the (region x account), etc.colossal-beach-47527
07/17/2018, 2:56 PMpulumi.getStackName()
. e.g. ${pulumi.getStackName()}-${baseName}-instance-profile
. That’s obviously a mouthful, but in situations where you need some stable identifier to disambiguate names, you have to use it.colossal-beach-47527
07/17/2018, 2:57 PMstocky-spoon-28903
07/17/2018, 3:38 PMnamePrefix
option since Pulumi appears to do something with the name
option.stocky-spoon-28903
07/17/2018, 3:38 PMcolossal-beach-47527
07/17/2018, 4:13 PMmicroscopic-florist-22719
Does Pulumi automatically do something with name prefixing?In general, TF-based providers implement auto-naming using a
defaults
layer on top of the TF schemas. This auto-naming suffers from exactly the problem you've noticed: it conflicts with namePrefix
if that property is also set. I'm not sure what the best way is to address this, but we definitely need to do something.microscopic-florist-22719
stocky-spoon-28903
07/17/2018, 5:56 PMmicroscopic-florist-22719
stocky-spoon-28903
07/17/2018, 5:59 PMname
is explicitly set, does that override the automatic numbering system?microscopic-florist-22719
white-balloon-205
${baseName}-instance-profile
is actually best practice and similar to what we use in most existing Pulumi packages. That is, combining a name provided by the user of the component with lightly-descriptive details on the child resource itself.microscopic-florist-22719
white-balloon-205
stocky-spoon-28903
07/17/2018, 6:38 PMwhite-balloon-205
name
explicitly - but that certainly isn't ideal).stocky-spoon-28903
07/17/2018, 6:46 PMhyphenated-names
but AWS roles want PascalCase
etc)white-balloon-205
namePrefix
for all resources - not sure we have an issue tracking that specific suggestion - feel free to open one in `pulumi-terraform‘.stocky-spoon-28903
07/17/2018, 6:52 PMstocky-spoon-28903
07/17/2018, 6:53 PM