using codebuild as deploy paired with ou path gives unclear error
default_providers:
source:
provider: codecommit
properties:
account_id: "123456789012"
deploy:
provider: codebuild
properties:
image: AMAZON_LINUX_2
spec_filename: deployspec.yml`
targets:
- /ou/test/123 <-- expecting account id
Results in an error about construct names for the stage already existing as it attempts to create multiple codebuild stages with the same name. This works as intended when using account ids as opposed to OU paths as it then only targets a single account and thus there is no duplicate stage name attempts.
The question becomes what would we like this to do when using a path? an idea could be that it fetches the account ids from the ou path and inserts them as an environment variable into a single codebuild project (stage).
I have this exact error. Used a full day trying to figure out that error message before I saw this issue. Thumbs up on fixing it for v3.1.0! Its making our terraform deployments in our accounts a bit ugly, when we must have a target for each account..
Also, +1 on proposed solution on setting env variables. Guess the respective env var would be TARGET_ACCOUNT_ID on each account.
Hi! Is there any update on this? We ran into the same problem and the proposed solution for adding the target account as an environment variable would work for us. This functionality could be added to any/all pipelines where the deployment is done through codebuild (it would not break the single account use case which already works).
Additionally the region could passed along in a similar manner, and if multiple regions are passed then the result could be creating stages for all combinations:
accounts: [123, 456] regions: eu-north-1, eu-west-1
combinations: [(123, eu-north-1), (123, eu-west-1), (456, eu-north-1), (456, eu-west-1)]