Skip to content

Commit

Permalink
Avoid deprecated terraform arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertGHippo committed Nov 22, 2024
1 parent 0fd1b69 commit c32c8a5
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 48 deletions.
53 changes: 28 additions & 25 deletions terraform/azure-remote-state/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ terraform {
}

provider "azurerm" {
skip_provider_registration = "true"
resource_provider_registrations = "none"

features {}
}
Expand All @@ -37,32 +37,11 @@ resource "azurerm_storage_account" "tfstate" {
resource_group_name = azurerm_resource_group.tfstate.name
location = var.default_azure_region
account_tier = "Standard"
account_kind = "StorageV2"
min_tls_version = "TLS1_2"
account_replication_type = "LRS"
allow_nested_items_to_be_public = false

queue_properties {
logging {
delete = true
read = true
write = true
version = "1.0"
retention_policy_days = 10
}
hour_metrics {
enabled = true
include_apis = true
version = "1.0"
retention_policy_days = 10
}
minute_metrics {
enabled = true
include_apis = true
version = "1.0"
retention_policy_days = 10
}
}

tags = merge(local.common_tags, {
"Region" = var.default_azure_region
})
Expand All @@ -75,10 +54,34 @@ resource "azurerm_storage_account" "tfstate" {
#checkov:skip=CKV2_AZURE_33:VNet not configured
}

resource "azurerm_storage_account_queue_properties" "tfstateq" {
storage_account_id = azurerm_storage_account.tfstate.id

logging {
version = "1.0"
delete = true
read = true
write = true
retention_policy_days = 10
}

hour_metrics {
version = "1.0"
include_apis = true
retention_policy_days = 10
}

minute_metrics {
version = "1.0"
include_apis = true
retention_policy_days = 10
}
}

resource "azurerm_storage_container" "tfstate" {
name = "${var.resource_name_prefix}-tfstate-stc"
storage_account_name = azurerm_storage_account.tfstate.name
storage_account_id = azurerm_storage_account.tfstate.id
container_access_type = "private"

#checkov:skip=CKV2_AZURE_21:Logging not required
}
}
49 changes: 26 additions & 23 deletions terraform/modules/azure-storage/storage.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,13 @@ resource "azurerm_storage_account" "sa" {
resource_group_name = var.resource_group
location = var.location
account_tier = "Standard"
account_kind = "StorageV2"
min_tls_version = "TLS1_2"
account_replication_type = "LRS"
allow_nested_items_to_be_public = false
cross_tenant_replication_enabled = false
shared_access_key_enabled = true

queue_properties {
logging {
delete = true
read = true
write = true
version = "1.0"
retention_policy_days = 10
}
hour_metrics {
enabled = true
include_apis = true
version = "1.0"
retention_policy_days = 10
}
minute_metrics {
enabled = true
include_apis = true
version = "1.0"
retention_policy_days = 10
}
}

blob_properties {
delete_retention_policy {
days = 7
Expand Down Expand Up @@ -58,6 +37,30 @@ resource "azurerm_storage_account" "sa" {
#checkov:skip=CKV2_AZURE_33:VNet not configured
}

resource "azurerm_storage_account_queue_properties" "saq" {
storage_account_id = azurerm_storage_account.sa.id

logging {
version = "1.0"
delete = true
read = true
write = true
retention_policy_days = 10
}

hour_metrics {
version = "1.0"
include_apis = true
retention_policy_days = 10
}

minute_metrics {
version = "1.0"
include_apis = true
retention_policy_days = 10
}
}

resource "azurerm_storage_account_network_rules" "sa_network_rules" {
storage_account_id = azurerm_storage_account.sa.id
default_action = "Deny"
Expand All @@ -68,7 +71,7 @@ resource "azurerm_storage_account_network_rules" "sa_network_rules" {

resource "azurerm_storage_container" "data_protection" {
name = "data-protection"
storage_account_name = azurerm_storage_account.sa.name
storage_account_id = azurerm_storage_account.sa.id
container_access_type = "private"

#checkov:skip=CKV2_AZURE_21:Logging not required
Expand Down

0 comments on commit c32c8a5

Please sign in to comment.