https://pulumi.com logo
#aws
Title
# aws
b

bland-painting-33593

02/08/2024, 8:50 PM
This feels like a really dumb question, but why does aws.ecs.cluster take a Name parameter if it's then going to stick something random on the end? Is there a way to stop that? I submitted a name of hsnext-prod-east-cluster and got hsnext-prod-east-cluster-1ff9f43. Is that going to change every time? Our Bitbucket pipelines need to reference that, so that'll be a problem. How do I get the exact name I specified?
I don't see that behavior mentioned in the documentation, either
l

little-cartoon-10569

02/08/2024, 8:54 PM
It's odd that it does that. Can you confirm that you don't have a resource or stack transformation that clears the name input? All other resources use name as an input specifically to stop Pulumi from generating unique suffices.
b

bland-painting-33593

02/08/2024, 8:58 PM
This is literally the entire code block?
l

little-cartoon-10569

02/08/2024, 8:58 PM
That said, it should be feasible to get the actual randomized name from Pulumi for use in your pipelines. You can push the name to somewhere in your CI system, or have your pipeline grab the name from the stack references. I know that well-known, widely-advertised names are often important or even essential, but the random suffix is really useful to allow Pulumi to always-on redeployments.
Stack transformations wouldn't be in the code block, they're be set up elsewhere. They apply to all resources in the stack.
Is that typescript? I've never seen that format before, let me look it up.
b

bland-painting-33593

02/08/2024, 8:59 PM
can you give me a hint as to what I would be looking for then? I'm still very new to this.
yeah, that's TS
ecs.service does the same thing for me
l

little-cartoon-10569

02/08/2024, 9:01 PM
The name you're setting is the Cluster settings name, not the Cluster name.
That's a bug.
b

bland-painting-33593

02/08/2024, 9:01 PM
the word transformations is no where in my index.ts, so not doing those based on the docs I just looked up
l

little-cartoon-10569

02/08/2024, 9:01 PM
It's not a transformation issue. You're just not setting the name. Try this:
Copy code
const hsnext_prod_east_cluster = new aws.ecs.Cluster("hsnext-prod-east-cluster", {
  name: "hsnext-prod-east-cluster",
 settings: [{
    name: "containerInsights",
    value: "enabled",
}]});
The name parameter is not the name property
b

bland-painting-33593

02/08/2024, 9:02 PM
Ok. Yeah, I literally copied the example in the docs
l

little-cartoon-10569

02/08/2024, 9:02 PM
You need to set the name property to get Pulumi to use it literally. The name parameter is used as the prefix of the default name; the name property eliminates the default name and uses what you configure.
b

bland-painting-33593

02/08/2024, 9:03 PM
gotcha. So yeah, that's probably what's wrong with Service as well
l

little-cartoon-10569

02/08/2024, 9:03 PM
There are good reasons to let Pulumi do the naming, but if you have better reasons not to allow that, then use the name property.
b

bland-painting-33593

02/08/2024, 9:03 PM
Thanks!
2 Views