-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix access to build repository from different AWS account (#737)
## Changes - Configure prod environment in separate prod AWS account - Move build repository config to separate file under app-config module - Consolidate image_repository_name config under build_repostiory_config.name - Add network_name, account_name, account_id, repository_arn, and repository_url attributes to build repository config - Replace ecr_repository data source in modules/service with image_repository_arn and image_repository_url passed in through variables ## Context The FFS project discovered a bug in multi-account project setups. The service module determined the build repository ARN and URL using a data source, but a data source can only fetch resources in the same account. In order to address this, we need to eliminate the data source and construct the repository ARN and repository URL through different means. The way we do it is by looking at which account the build repository is in (through app-config) and getting the id of that account, which gives us the necessary information to do this.
- Loading branch information
Showing
11 changed files
with
44 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
data "external" "account_ids_by_name" { | ||
program = ["${path.module}/../../../bin/account-ids-by-name"] | ||
} | ||
|
||
locals { | ||
image_repository_name = "${local.project_name}-${local.app_name}" | ||
image_repository_region = module.project_config.default_region | ||
image_repository_account_name = module.project_config.network_configs[local.shared_network_name].account_name | ||
image_repository_account_id = data.external.account_ids_by_name.result[local.image_repository_account_name] | ||
|
||
build_repository_config = { | ||
name = local.image_repository_name | ||
region = local.image_repository_region | ||
network_name = local.shared_network_name | ||
account_name = local.image_repository_account_name | ||
account_id = local.image_repository_account_id | ||
repository_arn = "arn:aws:ecr:${local.image_repository_region}:${local.image_repository_account_id}:repository/${local.image_repository_name}" | ||
repository_url = "${local.image_repository_account_id}.dkr.ecr.${local.image_repository_region}.amazonaws.com/${local.image_repository_name}" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters