-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
aws-ecs: Service resource named "Service" instead of "Resource" #3763
Comments
You're right, that is incorrect. Not sure whether we can safely change this. It will entail replacement of running Services. @SoManyHs, thoughts? |
I'm not in favour of updating the default since replacement would impact every customer who's using it today (nested stack or not). @rix0rrr There's already a property on the BaseServiceProps to pass in the service name. If someone wants to overwrite the current default, they could do it there, not forcing the replacement on users? |
This request is not about the service name though, but about the logical ID. See https://docs.aws.amazon.com/cdk/latest/guide/identifiers.html and https://docs.aws.amazon.com/cdk/latest/guide/resources.html#resources_physical_names |
If I'm not mistaken, the BaseService takes the ServiceName and uses it in place of the physicalName. Is this not the same thing? |
Yes, but I was under the impression the issue was about this line:
Where it says |
Ah I see, I don't think we can safely modify that without impacting every single user (from "Service" to "Resource"). As much as this is a bug, I believe this would be too much of a negative impact, especially for those users who don't mind the "Service" naming today. It would force replacement and that could potentially cause issues for any services that are already live today. @rix0rrr would it make sense to create a new flag that could be something like isResource which, if set to true, would replace the name with "Resource", but would default to false which would have logic to leave it as "Service"? This would allow users to update it to "Resource" if they choose, but leave it as "Service" for those who may already have a live service? Something like this:
|
Could be. It's a little elaborate though. What I'd like to know is: how bad is it to replace a running Service? (Keeping in mind that CloudFormation will bring up the new one before it will destroy the old one) If it can be done without availability impact, I would be okay to take the hit. As an example, I recall it's pretty easy to make changes to a TaskDefinition which will also cause the Service to be replaced. I half-remember even noticing it's on every TaskDefinition change. Now that kind of behavior requires an impactless update anyway, so if that's true, there's really no difference between this and a user-caused change. But I'm looking towards your team to tell me how bad the replacement would be. |
Can't you override the |
The issue is not about what |
I'm actually inclined to do the rename. @pkandasamy91, objections? |
I think there might be more impacted than just replacing the resource, I'd like to hold off until we can test a couple different scenarios. Couple questions that I had in mind:
|
Depends; if the service has a physical name, then doing the rename will actually fail. Otherwise, the name would be autogenerated (which it would be anyway), so it would have a semi-random suffix.
Yes. The logical id! Look at it this way, CloudFormation keeps a "logical ID -> physical ID" table in memory for every stack. So for example, the table could look like this:
Now, when you make a change to Now you'll also see why replacement of a hard-named service won't work. If the load balancer needed to be replaced, CloudFormation would first try to create a load balancer with name
For reference, from this page: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html Here are all the properties that any change to them cause the service to be replaced:
|
@rix0rrr based on the above, I have no issue. Is this something we still want to do, and should we do it sooner rather than later? |
The safe solution is probably to do it using a feature flag: https://github.com/aws/aws-cdk-rfcs/pull/56/files It's not a process that has gotten a lot of exercise, so talk to @eladb if you run into issues executing on the RFC. |
This issue has not received any attention in 1 year. If you want to keep this issue open, please leave a comment below and auto-close will be canceled. |
❓ General Issue
The Question
The
aws-ecs
BaseService
construct names the L1CfnService
resource as "Service" instead of the standard "Resource" (BaseService, example Resource). This manifests in CloudFormation logical IDs (and thus CloudFormation-generated names) with an unexpected "Service" at the end. The logical ID path deduping logic helps, as a directly-constructed Service named "*Service" won't get a duplicate "Service" at the end, but any other name, or if you nest theFargateService
construct within another construct and name it "Resource" you get this behavior. For example, the following code generates logical IDs: "FargateService7B4DE80D" and "ServiceService480762AE"Environment
The text was updated successfully, but these errors were encountered: