stocky-spoon-28903
07/17/2018, 4:33 AMStatements
optionally instead of complete `PolicyDocument`s, but this is a fairly common set of resources to find together in more traditional AWS infrastructure.colossal-beach-47527
07/17/2018, 2:51 PM... = new aws.iam.InstanceProfile(`${baseName}-instance-profile`, ...
${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.${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.pulumi.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.stocky-spoon-28903
07/17/2018, 3:38 PMnamePrefix
option since Pulumi appears to do something with the name
option.colossal-beach-47527
07/17/2018, 4:13 PMmicroscopic-florist-22719
07/17/2018, 5:37 PMDoes 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.stocky-spoon-28903
07/17/2018, 5:56 PMmicroscopic-florist-22719
07/17/2018, 5:57 PMstocky-spoon-28903
07/17/2018, 5:59 PMname
is explicitly set, does that override the automatic numbering system?microscopic-florist-22719
07/17/2018, 6:17 PMwhite-balloon-205
07/17/2018, 6:22 PM${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
07/17/2018, 6:28 PMwhite-balloon-205
07/17/2018, 6:35 PMstocky-spoon-28903
07/17/2018, 6:38 PMwhite-balloon-205
07/17/2018, 6:43 PMname
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
07/17/2018, 6:49 PMnamePrefix
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 PM