From 12adfb9ef1a392180d164300c4f24b2cee0fd6cf Mon Sep 17 00:00:00 2001 From: pasqualespica <36746022+pasqualespica@users.noreply.github.com> Date: Mon, 8 Jul 2024 16:54:26 +0200 Subject: [PATCH] fix --- .github/workflows/code_review.yml | 2 +- .github/workflows/deploy_with_github_runner.yml | 6 +++--- .github/workflows/integration_test.yml | 6 +++--- .identity/00_data.tf | 5 +++++ .identity/03_github_environment.tf | 2 +- 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/workflows/code_review.yml b/.github/workflows/code_review.yml index ccdb065b..f0b7252c 100644 --- a/.github/workflows/code_review.yml +++ b/.github/workflows/code_review.yml @@ -59,7 +59,7 @@ jobs: # from https://github.com/Azure/login/commits/master uses: azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 with: - client-id: ${{ secrets.CLIENT_ID }} + client-id: ${{ secrets.CD_CLIENT_ID }} tenant-id: ${{ secrets.TENANT_ID }} subscription-id: ${{ secrets.SUBSCRIPTION_ID }} diff --git a/.github/workflows/deploy_with_github_runner.yml b/.github/workflows/deploy_with_github_runner.yml index b7a32518..f2cd8ebe 100644 --- a/.github/workflows/deploy_with_github_runner.yml +++ b/.github/workflows/deploy_with_github_runner.yml @@ -35,7 +35,7 @@ jobs: # from https://github.com/pagopa/eng-github-actions-iac-template/tree/main/azure/github-self-hosted-runner-azure-create-action uses: pagopa/eng-github-actions-iac-template/azure/github-self-hosted-runner-azure-create-action@main with: - client_id: ${{ secrets.CLIENT_ID }} + client_id: ${{ secrets.CD_CLIENT_ID }} tenant_id: ${{ secrets.TENANT_ID }} subscription_id: ${{ secrets.SUBSCRIPTION_ID }} container_app_environment_name: ${{ vars.CONTAINER_APP_ENVIRONMENT_NAME }} @@ -54,7 +54,7 @@ jobs: uses: pagopa/github-actions-template/aks-deploy@main with: branch: ${{ github.ref_name }} - client_id: ${{ secrets.CLIENT_ID }} + client_id: ${{ secrets.CD_CLIENT_ID }} subscription_id: ${{ secrets.SUBSCRIPTION_ID }} tenant_id: ${{ secrets.TENANT_ID }} env: ${{ inputs.environment }} @@ -76,7 +76,7 @@ jobs: # from https://github.com/pagopa/eng-github-actions-iac-template/tree/main/azure/github-self-hosted-runner-azure-cleanup-action uses: pagopa/eng-github-actions-iac-template/azure/github-self-hosted-runner-azure-cleanup-action@0ee2f58fd46d10ac7f00bce4304b98db3dbdbe9a with: - client_id: ${{ secrets.CLIENT_ID }} + client_id: ${{ secrets.CD_CLIENT_ID }} tenant_id: ${{ secrets.TENANT_ID }} subscription_id: ${{ secrets.SUBSCRIPTION_ID }} resource_group_name: ${{ vars.CONTAINER_APP_ENVIRONMENT_RESOURCE_GROUP_NAME }} diff --git a/.github/workflows/integration_test.yml b/.github/workflows/integration_test.yml index faef7be4..6654b230 100644 --- a/.github/workflows/integration_test.yml +++ b/.github/workflows/integration_test.yml @@ -45,7 +45,7 @@ jobs: # from https://github.com/pagopa/eng-github-actions-iac-template/tree/main/azure/github-self-hosted-runner-azure-create-action uses: pagopa/eng-github-actions-iac-template/azure/github-self-hosted-runner-azure-create-action@main with: - client_id: ${{ secrets.CLIENT_ID }} + client_id: ${{ secrets.CD_CLIENT_ID }} tenant_id: ${{ secrets.TENANT_ID }} subscription_id: ${{ secrets.SUBSCRIPTION_ID }} container_app_environment_name: ${{ vars.CONTAINER_APP_ENVIRONMENT_NAME }} @@ -69,7 +69,7 @@ jobs: # from https://github.com/Azure/login/commits/master uses: azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 with: - client-id: ${{ secrets.CLIENT_ID }} + client-id: ${{ secrets.CD_CLIENT_ID }} tenant-id: ${{ secrets.TENANT_ID }} subscription-id: ${{ secrets.SUBSCRIPTION_ID }} @@ -152,7 +152,7 @@ jobs: # from https://github.com/pagopa/eng-github-actions-iac-template/tree/main/azure/github-self-hosted-runner-azure-cleanup-action uses: pagopa/eng-github-actions-iac-template/azure/github-self-hosted-runner-azure-cleanup-action@0ee2f58fd46d10ac7f00bce4304b98db3dbdbe9a with: - client_id: ${{ secrets.CLIENT_ID }} + client_id: ${{ secrets.CD_CLIENT_ID }} tenant_id: ${{ secrets.TENANT_ID }} subscription_id: ${{ secrets.SUBSCRIPTION_ID }} resource_group_name: ${{ vars.CONTAINER_APP_ENVIRONMENT_RESOURCE_GROUP_NAME }} diff --git a/.identity/00_data.tf b/.identity/00_data.tf index dc87495a..7cbb2d11 100644 --- a/.identity/00_data.tf +++ b/.identity/00_data.tf @@ -3,6 +3,11 @@ data "azurerm_storage_account" "tfstate_app" { resource_group_name = "io-infra-rg" } +data "azurerm_user_assigned_identity" "identity_cd" { + resource_group_name = "${local.product}-identity-rg" + name = "${local.product}-${local.domain}-01-github-cd-identity" +} + data "azurerm_resource_group" "dashboards" { name = "dashboards" } diff --git a/.identity/03_github_environment.tf b/.identity/03_github_environment.tf index 667f2014..719e830e 100644 --- a/.identity/03_github_environment.tf +++ b/.identity/03_github_environment.tf @@ -21,7 +21,7 @@ resource "github_repository_environment" "github_repository_environment" { locals { env_secrets = { - "CLIENT_ID" : module.github_runner_app.application_id, + "CD_CLIENT_ID" : data.azurerm_user_assigned_identity.identity_cd.client_id, "TENANT_ID" : data.azurerm_client_config.current.tenant_id, "SUBSCRIPTION_ID" : data.azurerm_subscription.current.subscription_id, "COSMOS_DB_PRIMARY_KEY" : data.azurerm_cosmosdb_account.bizevents_cosmos.primary_key,