diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 2f807e1..10ec87b 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -91,6 +91,8 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} INFRACOST_TERRAFORM_CLI_WRAPPER: false TF_VAR_slack_webhook_url: ${{ secrets.TF_VAR_slack_webhook_url }} + TF_VAR_operation_account_id: ${{ secrets.TF_VAR_operation_account_id }} + TF_VAR_prod_account_id: ${{ secrets.TF_VAR_prod_account_id }} steps: - name: Checkout Code diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 7d5d252..d79262b 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -109,3 +109,6 @@ jobs: env: TF_VAR_slack_webhook_url: ${{ secrets.TF_VAR_slack_webhook_url }} TF_VAR_allowed_source_ips: ${{ secrets.TF_VAR_allowed_source_ips }} + TF_VAR_operation_account_id: ${{ secrets.TF_VAR_operation_account_id }} + TF_VAR_prod_account_id: ${{ secrets.TF_VAR_prod_account_id }} + diff --git a/.gitignore b/.gitignore index 08d0023..5e1575d 100644 --- a/.gitignore +++ b/.gitignore @@ -28,4 +28,4 @@ ehthumbs.db # Windows .vscode/ # OpenSearch alert 생성 시 생기는 임시 파일 -modules/opensearch/slack_response.json \ No newline at end of file +modules/opensearch/slack_response.json diff --git a/management-team-account/inspector-delegation/organizations/main.tf b/management-team-account/inspector-delegation/organizations/main.tf index 3f02a96..6ff7604 100644 --- a/management-team-account/inspector-delegation/organizations/main.tf +++ b/management-team-account/inspector-delegation/organizations/main.tf @@ -12,15 +12,6 @@ provider "aws" { region = "ap-northeast-2" } -provider "aws" { - alias = "operation" - region = "ap-northeast-2" -} - -data "aws_caller_identity" "operation" { - provider = aws.operation -} - resource "aws_inspector2_delegated_admin_account" "this" { - account_id = data.aws_caller_identity.operation.account_id + account_id = var.operation_account_id } \ No newline at end of file diff --git a/management-team-account/inspector-delegation/organizations/variables.tf b/management-team-account/inspector-delegation/organizations/variables.tf new file mode 100644 index 0000000..d338387 --- /dev/null +++ b/management-team-account/inspector-delegation/organizations/variables.tf @@ -0,0 +1,5 @@ +variable "operation_account_id" { + description = "operation account" + type = string + sensitive = true +} diff --git a/operation-team-account/runtime-verification/inspector/main.tf b/operation-team-account/runtime-verification/inspector/main.tf index cb6f1ff..c63f46b 100644 --- a/operation-team-account/runtime-verification/inspector/main.tf +++ b/operation-team-account/runtime-verification/inspector/main.tf @@ -12,14 +12,6 @@ provider "aws" { region = "ap-northeast-2" } -provider "aws" { - alias = "prod" - region = "ap-northeast-2" -} - -data "aws_caller_identity" "prod" { - provider = aws.prod -} data "aws_caller_identity" "current" {} @@ -29,5 +21,5 @@ resource "aws_inspector2_enabler" "this" { } resource "aws_inspector2_delegated_admin_account" "prod_account" { - account_id = data.aws_caller_identity.prod.account_id + account_id = var.prod_account_id } \ No newline at end of file diff --git a/operation-team-account/runtime-verification/inspector/variables.tf b/operation-team-account/runtime-verification/inspector/variables.tf new file mode 100644 index 0000000..1915267 --- /dev/null +++ b/operation-team-account/runtime-verification/inspector/variables.tf @@ -0,0 +1,5 @@ +variable "prod_account_id" { + description = "prod account" + type = string + sensitive = true +}