feat(ecs): RFC: Allow for multiple ECS environment files on a single task definition (#21313) #25031
+5
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What
This PR includes a fix for the hard coded reference to
EnvironmentFile
reference in the ecsAssetEnvironmentFile
construct.Why
Currently only a single
AssetEnvironmentFile
can be used with a container definition (as outlined in #21313). This is because the underlying "Asset" construct has a hard coded construct Id that conflicts when multipleAssetEnvironmentFiles
are bound to the same scope.How does this fix things:
This PR changes the way the ID is sourced for the
Asset
construct to ensure it is unique (But a stable value).The new approach:
EnvironmentFile
EnvironmentPattern{N}
Ids will be generated for each scope as follows:
EnvironmentFile
EnvironmentFile1
EnvironmentFile2
EnvironmentFile{N}
(This follows a similar pattern to the IDS generated for RDS Database Instances)
Why might this be a good approach?
I think this is likley going to be the least disruptive way of resolving this issue as:
AssetEnvironmentFile.bind
will always return a construct with an ID of 'EnvironmentFile')EnvironmentFile
(s) that increment independently.Possible issues with approach
There are some issues with this approach however including:
EnvironmentFile2
gets removed andEnvironmentFile3 -> EnvironmentFile2
,EnvironmentFile4->EnvironmentFile3
. I am not sure if this is likely to cause issues.RFC
It would be great to get some input if this would be an appropriate fix verses directly passing ID's down to the lower level constructs. (Or hashing the paths to the assets as suggested in the original issue)
If this looks good I can add some new test cases for this 👀
Closes #21313.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license