From 7c13a5832c0c4209a643127b80c0298000a4cab3 Mon Sep 17 00:00:00 2001 From: pasqualespica <36746022+pasqualespica@users.noreply.github.com> Date: Mon, 29 Apr 2024 17:44:54 +0200 Subject: [PATCH] fix fed ident --- .github/workflows/code_review.yml | 2 +- .github/workflows/create_dashboard.yaml | 2 +- .../workflows/deploy_with_github_runner.yml | 6 +- .github/workflows/integration_test.yml | 2 +- .identity/00_data.tf | 5 ++ .identity/02_application_action.tf | 84 ------------------- .identity/03_github_environment.tf | 2 +- 7 files changed, 12 insertions(+), 91 deletions(-) delete mode 100644 .identity/02_application_action.tf diff --git a/.github/workflows/code_review.yml b/.github/workflows/code_review.yml index 1e13d007..6953d055 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/create_dashboard.yaml b/.github/workflows/create_dashboard.yaml index 61fa2510..6fd77edc 100644 --- a/.github/workflows/create_dashboard.yaml +++ b/.github/workflows/create_dashboard.yaml @@ -43,7 +43,7 @@ jobs: environment: ${{ matrix.environment }} api-name: config: .opex/env/${{ matrix.environment }}/config.yaml - client-id: ${{ secrets.CLIENT_ID }} + client-id: ${{ secrets.CD_CLIENT_ID }} tenant-id: ${{ secrets.TENANT_ID }} subscription-id: ${{ secrets.SUBSCRIPTION_ID }} # from https://github.com/pagopa/opex-dashboard-azure-action/pkgs/container/opex-dashboard-azure-action diff --git a/.github/workflows/deploy_with_github_runner.yml b/.github/workflows/deploy_with_github_runner.yml index c802f4da..0e4f648e 100644 --- a/.github/workflows/deploy_with_github_runner.yml +++ b/.github/workflows/deploy_with_github_runner.yml @@ -36,7 +36,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 bcf08ec3..f1f9d149 100644 --- a/.github/workflows/integration_test.yml +++ b/.github/workflows/integration_test.yml @@ -47,7 +47,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/.identity/00_data.tf b/.identity/00_data.tf index 026764d8..0e58c2c0 100644 --- a/.identity/00_data.tf +++ b/.identity/00_data.tf @@ -1,3 +1,8 @@ +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/02_application_action.tf b/.identity/02_application_action.tf deleted file mode 100644 index 50e5776d..00000000 --- a/.identity/02_application_action.tf +++ /dev/null @@ -1,84 +0,0 @@ -module "github_runner_app" { - source = "git::https://github.com/pagopa/github-actions-tf-modules.git//app-github-runner-creator?ref=main" - - app_name = local.app_name - - subscription_id = data.azurerm_subscription.current.id - - github_org = local.github.org - github_repository = local.github.repository - github_environment_name = var.env - - container_app_github_runner_env_rg = local.container_app_environment.resource_group -} - -resource "null_resource" "github_runner_app_permissions_to_namespace" { - triggers = { - aks_id = data.azurerm_kubernetes_cluster.aks.id - service_principal_id = module.github_runner_app.client_id - namespace = local.domain - version = "v2" - } - - provisioner "local-exec" { - command = <