Skip to content

Commit

Permalink
skip: update CI 218
Browse files Browse the repository at this point in the history
  • Loading branch information
vit-corp committed Aug 26, 2024
1 parent fa2cec3 commit 4db5dda
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 70 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/auto-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
resource_priority_list:
type: string
description: Priority list for resources (you can remove unnecessary resources during testing)
default: '["storage", "webapp", "vnet", "network", "vm", "synapse", "sql", "mysql", "subscription", "disk", "postgresql", "cosmosdb", "signalr", "spring", "search", "service-fabric", "stream", "redis", "servicebus", "role", "monitor", "machine-learning", "logic", "kusto", "aks", "keyvault", "iothub", "front-door", "event", "data", "defender", "container", "cognitiveservice", "batch", "automation", "application", "app-configuration", "api", "alert"]'
default: '["postgresql"]'
#'["storage", "webapp", "vnet", "network", "vm", "synapse", "sql", "mysql", "subscription", "disk", "postgresql", "cosmosdb", "signalr", "spring", "search", "service-fabric", "stream", "redis", "servicebus", "role", "monitor", "machine-learning", "logic", "kusto", "aks", "keyvault", "iothub", "front-door", "event", "data", "defender", "container", "cognitiveservice", "batch", "automation", "application", "app-configuration", "api", "alert"]'
required: true

Expand All @@ -24,7 +24,7 @@ env:
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
AZURE_SECRET_VALUE: ${{ secrets.AZURE_SECRET_VALUE }}
default_resource_priority_list: '["storage", "webapp", "vnet", "network", "vm", "synapse", "sql", "mysql", "subscription", "disk", "postgresql", "cosmosdb", "signalr", "spring", "search", "service-fabric", "stream", "redis", "servicebus", "role", "monitor", "machine-learning", "logic", "kusto", "aks", "keyvault", "iothub", "front-door", "event", "data", "defender", "container", "cognitiveservice", "batch", "automation", "application", "app-configuration", "api", "alert"]'
default_resource_priority_list: '["postgresql"]'
#default_resource_priority_list: '["storage", "webapp", "vnet", "network", "vm", "synapse", "sql", "mysql", "subscription", "disk", "postgresql", "cosmosdb", "signalr", "spring", "search", "service-fabric", "stream", "redis", "servicebus", "role", "monitor", "machine-learning", "logic", "kusto", "aks", "keyvault", "iothub", "front-door", "event", "data", "defender", "container", "cognitiveservice", "batch", "automation", "application", "app-configuration", "api", "alert"]'
TF_VAR_project: ${{ secrets.TF_VAR_project }}
TF_VAR_region: ${{ secrets.AWS_REGION }}
Expand Down
48 changes: 8 additions & 40 deletions auto_policy_testing/green/postgresql/key_vault.tf
Original file line number Diff line number Diff line change
@@ -1,42 +1,10 @@
#data "azurerm_client_config" "current" {}
#
#resource "azurerm_key_vault" "this" {
# name = "${module.naming.resource_prefix.keyvault}${random_integer.this.result}"
# location = data.terraform_remote_state.common.outputs.location
# resource_group_name = data.terraform_remote_state.common.outputs.resource_group
# tenant_id = data.azurerm_client_config.current.tenant_id
# sku_name = "premium"
#
# purge_protection_enabled = true
#}
data "azurerm_client_config" "current" {}

#resource "azurerm_key_vault_access_policy" "server" {
# key_vault_id = azurerm_key_vault.this.id
# tenant_id = azurerm_postgresql_server.cmk.identity[0].tenant_id
# object_id = azurerm_postgresql_server.cmk.identity[0].principal_id
#
# key_permissions = ["Get", "UnwrapKey", "WrapKey"]
# secret_permissions = ["Get"]
#}
resource "azurerm_key_vault_access_policy" "server" {
key_vault_id = data.terraform_remote_state.common.outputs.key_vault_id
tenant_id = azurerm_postgresql_server.cmk.identity[0].tenant_id
object_id = azurerm_postgresql_server.cmk.identity[0].principal_id

#resource "azurerm_key_vault_access_policy" "client" {
# key_vault_id = azurerm_key_vault.this.id
# tenant_id = data.azurerm_client_config.current.tenant_id
# object_id = data.azurerm_client_config.current.object_id
#
# key_permissions = ["Get", "Create", "Delete", "List", "Restore", "Recover", "UnwrapKey", "WrapKey", "Purge", "Encrypt", "Decrypt", "Sign", "Verify", "GetRotationPolicy", "SetRotationPolicy"]
# secret_permissions = ["Get"]
#}

#resource "azurerm_key_vault_key" "this" {
# name = "${module.naming.resource_prefix.keyvault-key}-${random_integer.this.result}"
# key_vault_id = azurerm_key_vault.this.id
# key_type = "RSA"
# key_size = 2048
# key_opts = ["decrypt", "encrypt", "sign", "unwrapKey", "verify", "wrapKey"]
#
# depends_on = [
# azurerm_key_vault_access_policy.server,
# azurerm_key_vault_access_policy.client
# ]
#}
key_permissions = ["Get", "UnwrapKey", "WrapKey"]
secret_permissions = ["Get"]
}
2 changes: 1 addition & 1 deletion auto_policy_testing/green/postgresql/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
output "postgresql" {
value = {
postgresql-server = azurerm_postgresql_server.this.id
#ecc-azure-203-asb_postgresql_encrypt_cmk = azurerm_postgresql_server.cmk.id
ecc-azure-203-asb_postgresql_encrypt_cmk = azurerm_postgresql_server.cmk.id
}
}
26 changes: 0 additions & 26 deletions auto_policy_testing/green/postgresql/postgresql_server.tf
Original file line number Diff line number Diff line change
Expand Up @@ -30,32 +30,6 @@ resource "azurerm_postgresql_server" "this" {
tags = module.naming.default_tags
}

#resource "azurerm_postgresql_server" "cmk" {
# name = "${module.naming.resource_prefix.postgresql-server}-cmk"
# location = data.terraform_remote_state.common.outputs.location
# resource_group_name = data.terraform_remote_state.common.outputs.resource_group
#
# sku_name = "GP_Gen5_2"
# version = "11"
# storage_mb = 51200
#
# administrator_login = random_string.this.result
# administrator_login_password = random_password.this.result
#
# ssl_enforcement_enabled = true
#
# identity {
# type = "SystemAssigned"
# }
#
# tags = module.naming.default_tags
#}

#resource "azurerm_postgresql_server_key" "this" {
# server_id = azurerm_postgresql_server.cmk.id
# key_vault_key_id = azurerm_key_vault_key.this.id
#}

resource "azurerm_postgresql_configuration" "log_checkpoints" {
name = "log_checkpoints"
resource_group_name = data.terraform_remote_state.common.outputs.resource_group
Expand Down
25 changes: 25 additions & 0 deletions auto_policy_testing/green/postgresql/postgresql_server_cmk.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
resource "azurerm_postgresql_server" "cmk" {
name = "${module.naming.resource_prefix.postgresql-server}-cmk"
location = data.terraform_remote_state.common.outputs.location
resource_group_name = data.terraform_remote_state.common.outputs.resource_group

sku_name = "GP_Gen5_2"
version = "11"
storage_mb = 51200

administrator_login = random_string.this.result
administrator_login_password = random_password.this.result

ssl_enforcement_enabled = true

identity {
type = "SystemAssigned"
}

tags = module.naming.default_tags
}

resource "azurerm_postgresql_server_key" "this" {
server_id = azurerm_postgresql_server.cmk.id
key_vault_key_id = data.terraform_remote_state.common.outputs.key_id
}
1 change: 0 additions & 1 deletion auto_policy_testing/scripts/exception_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"ecc-azure-368-vmss_omi_vulnerability", #policy doesn't work
"ecc-azure-378-cis_nsg_flow_log_analytics", #policy doesn't work
"ecc-azure-201-asb_cosmosdb_encrypt_cmk", #policy work but need additional permissions
"ecc-azure-203-asb_postgresql_encrypt_cmk", #policy work but terraform destroy fails pipeline
"ecc-azure-302-redis_cache_disabled_public_access", #python sdk should be updated
"ecc-azure-354-acr_anonymous_pull", #issue with policy, should be reviewed and fixed
"ecc-azure-143-asb_api_mgmt_vnet" #issue with terraform, should be reviewed and fixed
Expand Down

0 comments on commit 4db5dda

Please sign in to comment.