Skip to content

Commit

Permalink
[EC-251] Remove KeyVault access policies on deleted service principals (
Browse files Browse the repository at this point in the history
  • Loading branch information
Krusty93 authored Apr 10, 2024
1 parent 1c77ac3 commit 0933ac8
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 130 deletions.
6 changes: 0 additions & 6 deletions src/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,6 @@
| [azurerm_key_vault_access_policy.azdevops_platform_iac_policy_kv_common](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_access_policy) | resource |
| [azurerm_key_vault_access_policy.cdn_common](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_access_policy) | resource |
| [azurerm_key_vault_access_policy.cdn_kv](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_access_policy) | resource |
| [azurerm_key_vault_access_policy.github_action_iac_cd_kv](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_access_policy) | resource |
| [azurerm_key_vault_access_policy.github_action_iac_cd_kv_common](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_access_policy) | resource |
| [azurerm_key_vault_access_policy.github_action_iac_ci_kv](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_access_policy) | resource |
| [azurerm_key_vault_access_policy.github_action_iac_ci_kv_common](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_access_policy) | resource |
| [azurerm_key_vault_access_policy.v2_common](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_access_policy) | resource |
| [azurerm_key_vault_secret.appbackend-NORIFICATIONS-STORAGE](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_secret) | resource |
| [azurerm_key_vault_secret.appbackend-PUSH-NOTIFICATIONS-STORAGE](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_secret) | resource |
Expand Down Expand Up @@ -321,8 +317,6 @@
| [azuread_group.adgroup_admin](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/data-sources/group) | data source |
| [azuread_group.adgroup_developers](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/data-sources/group) | data source |
| [azuread_service_principal.app_gw_uai_kvreader](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/data-sources/service_principal) | data source |
| [azuread_service_principal.github_action_iac_cd](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/data-sources/service_principal) | data source |
| [azuread_service_principal.github_action_iac_ci](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/data-sources/service_principal) | data source |
| [azuread_service_principal.platform_iac_sp](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/data-sources/service_principal) | data source |
| [azurerm_api_management_group.api_v2_lollipop_assertion_read](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/api_management_group) | data source |
| [azurerm_api_management_product.apim_v2_product_lollipop](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/api_management_product) | data source |
Expand Down
48 changes: 0 additions & 48 deletions src/core/keyvault_access_policy.tf
Original file line number Diff line number Diff line change
Expand Up @@ -159,51 +159,3 @@ resource "azurerm_key_vault_access_policy" "azdevops_platform_iac_policy_kv_comm
storage_permissions = []
certificate_permissions = ["SetIssuers", "DeleteIssuers", "Purge", "List", "Get", "ManageContacts", ]
}

data "azuread_service_principal" "github_action_iac_cd" {
display_name = "github-pagopa-io-infra-prod-cd"
}

resource "azurerm_key_vault_access_policy" "github_action_iac_cd_kv" {
key_vault_id = module.key_vault.id
tenant_id = data.azurerm_client_config.current.tenant_id
object_id = data.azuread_service_principal.github_action_iac_cd.object_id

secret_permissions = ["Get", "List", "Set", ]
storage_permissions = []
certificate_permissions = ["SetIssuers", "DeleteIssuers", "Purge", "List", "Get", "ManageContacts", ]
}

resource "azurerm_key_vault_access_policy" "github_action_iac_cd_kv_common" {
key_vault_id = module.key_vault_common.id
tenant_id = data.azurerm_client_config.current.tenant_id
object_id = data.azuread_service_principal.github_action_iac_cd.object_id

secret_permissions = ["Get", "List", "Set", ]
storage_permissions = []
certificate_permissions = ["SetIssuers", "DeleteIssuers", "Purge", "List", "Get", "ManageContacts", ]
}

data "azuread_service_principal" "github_action_iac_ci" {
display_name = "github-pagopa-io-infra-prod-ci"
}

resource "azurerm_key_vault_access_policy" "github_action_iac_ci_kv" {
key_vault_id = module.key_vault.id
tenant_id = data.azurerm_client_config.current.tenant_id
object_id = data.azuread_service_principal.github_action_iac_ci.object_id

secret_permissions = ["Get", "List", ]
storage_permissions = []
certificate_permissions = ["Get", "List", ]
}

resource "azurerm_key_vault_access_policy" "github_action_iac_ci_kv_common" {
key_vault_id = module.key_vault_common.id
tenant_id = data.azurerm_client_config.current.tenant_id
object_id = data.azuread_service_principal.github_action_iac_ci.object_id

secret_permissions = ["Get", "List", ]
storage_permissions = []
certificate_permissions = ["Get", "List", ]
}
32 changes: 0 additions & 32 deletions src/domains/citizen-auth-common/02_key_vault.tf
Original file line number Diff line number Diff line change
Expand Up @@ -86,38 +86,6 @@ resource "azurerm_key_vault_access_policy" "azdevops_platform_iac_policy" {
certificate_permissions = ["SetIssuers", "DeleteIssuers", "Purge", "List", "Get", "ManageContacts", ]
}


data "azuread_service_principal" "github_action_iac_cd" {
display_name = "github-pagopa-io-infra-prod-cd"
}

resource "azurerm_key_vault_access_policy" "github_action_iac_cd_kv" {
key_vault_id = module.key_vault.id
tenant_id = data.azurerm_client_config.current.tenant_id
object_id = data.azuread_service_principal.github_action_iac_cd.object_id

secret_permissions = ["Get", "List", "Set", ]
storage_permissions = []
certificate_permissions = ["SetIssuers", "DeleteIssuers", "Purge", "List", "Get", "ManageContacts", "Create", ]
}

data "azuread_service_principal" "github_action_iac_ci" {
display_name = "github-pagopa-io-infra-prod-ci"
}

resource "azurerm_key_vault_access_policy" "github_action_iac_ci_kv" {
key_vault_id = module.key_vault.id
tenant_id = data.azurerm_client_config.current.tenant_id
object_id = data.azuread_service_principal.github_action_iac_ci.object_id

secret_permissions = ["Get", "List", ]
storage_permissions = []
certificate_permissions = ["Get", "List", ]
key_permissions = [
"Get",
]
}

resource "azurerm_key_vault_certificate" "lollipop_certificate_v1" {
name = "lollipop-certificate-v1"
key_vault_id = module.key_vault.id
Expand Down
4 changes: 0 additions & 4 deletions src/domains/citizen-auth-common/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@
| [azurerm_key_vault_access_policy.adgroup_admin](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_access_policy) | resource |
| [azurerm_key_vault_access_policy.adgroup_developers](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_access_policy) | resource |
| [azurerm_key_vault_access_policy.azdevops_platform_iac_policy](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_access_policy) | resource |
| [azurerm_key_vault_access_policy.github_action_iac_cd_kv](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_access_policy) | resource |
| [azurerm_key_vault_access_policy.github_action_iac_ci_kv](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_access_policy) | resource |
| [azurerm_key_vault_certificate.lollipop_certificate_v1](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_certificate) | resource |
| [azurerm_key_vault_secret.appinsights_connection_string](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_secret) | resource |
| [azurerm_key_vault_secret.appinsights_instrumentation_key](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_secret) | resource |
Expand All @@ -76,8 +74,6 @@
| [azuread_group.adgroup_developers](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/data-sources/group) | data source |
| [azuread_group.adgroup_externals](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/data-sources/group) | data source |
| [azuread_group.adgroup_security](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/data-sources/group) | data source |
| [azuread_service_principal.github_action_iac_cd](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/data-sources/service_principal) | data source |
| [azuread_service_principal.github_action_iac_ci](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/data-sources/service_principal) | data source |
| [azuread_service_principal.platform_iac_sp](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/data-sources/service_principal) | data source |
| [azurerm_api_management.apim_v2_api](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/api_management) | data source |
| [azurerm_application_insights.application_insights](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/application_insights) | data source |
Expand Down
36 changes: 0 additions & 36 deletions src/domains/ioweb-common/02_security.tf
Original file line number Diff line number Diff line change
Expand Up @@ -66,42 +66,6 @@ resource "azurerm_key_vault_access_policy" "access_policy_io_infra_cd" {
certificate_permissions = ["Get", "List"]
}

# Access policy for CD pipeline

data "azuread_service_principal" "github_action_iac_cd" {
display_name = "github-pagopa-io-infra-prod-cd"
}

resource "azurerm_key_vault_access_policy" "github_action_iac_cd_kv" {
key_vault_id = module.key_vault.id
tenant_id = data.azurerm_client_config.current.tenant_id
object_id = data.azuread_service_principal.github_action_iac_cd.object_id

secret_permissions = ["Get", "List", "Set", ]
storage_permissions = []
certificate_permissions = ["SetIssuers", "DeleteIssuers", "Purge", "List", "Get", "ManageContacts", "Create", ]
}


# Access policy for CI pipeline

data "azuread_service_principal" "github_action_iac_ci" {
display_name = "github-pagopa-io-infra-prod-ci"
}

resource "azurerm_key_vault_access_policy" "github_action_iac_ci_kv" {
key_vault_id = module.key_vault.id
tenant_id = data.azurerm_client_config.current.tenant_id
object_id = data.azuread_service_principal.github_action_iac_ci.object_id

secret_permissions = ["Get", "List", ]
storage_permissions = []
certificate_permissions = ["Get", "List", ]
key_permissions = [
"Get",
]
}

#
# Azure DevOps policy
#
Expand Down
4 changes: 0 additions & 4 deletions src/domains/ioweb-common/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@
| [azurerm_key_vault_access_policy.adgroup_admin](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_access_policy) | resource |
| [azurerm_key_vault_access_policy.adgroup_developers](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_access_policy) | resource |
| [azurerm_key_vault_access_policy.azdevops_platform_iac_policy_ioweb_kv](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_access_policy) | resource |
| [azurerm_key_vault_access_policy.github_action_iac_cd_kv](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_access_policy) | resource |
| [azurerm_key_vault_access_policy.github_action_iac_ci_kv](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_access_policy) | resource |
| [azurerm_key_vault_access_policy.policy_ioweb_cdn_kv](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_access_policy) | resource |
| [azurerm_key_vault_secret.appinsights_connection_string](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_secret) | resource |
| [azurerm_key_vault_secret.appinsights_instrumentation_key](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_secret) | resource |
Expand All @@ -52,8 +50,6 @@
| [azuread_group.adgroup_developers](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/data-sources/group) | data source |
| [azuread_group.adgroup_externals](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/data-sources/group) | data source |
| [azuread_group.adgroup_security](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/data-sources/group) | data source |
| [azuread_service_principal.github_action_iac_cd](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/data-sources/service_principal) | data source |
| [azuread_service_principal.github_action_iac_ci](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/data-sources/service_principal) | data source |
| [azuread_service_principal.platform_iac_sp](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/data-sources/service_principal) | data source |
| [azurerm_api_management.apim_v2_api](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/api_management) | data source |
| [azurerm_application_insights.application_insights](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/application_insights) | data source |
Expand Down

0 comments on commit 0933ac8

Please sign in to comment.