Manifest Environment Variables for Array #4907
-
Hi, Is there an example on how to parse an array of strings from a shell variable to the manifest.yml?
manifest.yaml: my .env file (values substituted out): The error:
security_groups:
Any advice and help would be greatly appreciated. Thank you for reading this and for your time. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Hello @Kqirk 👋🏼 I can confirm that non-array env vars aren't supported in the manifest yet. A short explanation - ⬇️ is not working because network:
vpc:
security_groups: ${SECURITY_GROUPS} This is an interesting case that you raised, perhaps Copilot should support non-string env vars types. For now, I think you probably do need to write it as ⬇️ unfortunately : ( security_groups:
-${sg_1}
-${sg_2} I understand that the number of SGs might differ across envs, but are they not known in advance? Are you probably aware that manifest supports environment overrides like below: network:
vpc:
security_groups: ["sg-1","sg-2"]
environments:
test:
network:
vpc:
security_groups: ["sg-3","sg-4", "sg-5"]
prod:
network:
vpc:
security_groups: ["sg-3","sg-4"] |
Beta Was this translation helpful? Give feedback.
-
This is now enabled in v1.29.0: https://github.com/aws/copilot-cli/releases/tag/v1.29.0! |
Beta Was this translation helpful? Give feedback.
Hello @Kqirk 👋🏼 I can confirm that non-array env vars aren't supported in the manifest yet.
A short explanation - ⬇️ is not working because
${SECURITY_GROUPS}
is recognized as a string first, before Copilot even tries to read it as an env var. This causes failure to unmarshal, becausesecurity_groups
as a YAML field is expectingslice of strings or compose-style map
.This is an interesting case that you raised, perhaps Copilot should support non-string env vars types.
For now, I think you probably do need to write it as ⬇️ unfortunately : (
I understand that the number of SGs might differ across…