Skip to content

Commit

Permalink
use keyvault variable in storageaccount terraform (#1101)
Browse files Browse the repository at this point in the history
* storageaccount keyvault

* change storageaccount keyvault prod

* Update name
  • Loading branch information
sondresjolyst authored Nov 24, 2023
1 parent e2c5202 commit 0ce3e99
Show file tree
Hide file tree
Showing 15 changed files with 62 additions and 32 deletions.
4 changes: 2 additions & 2 deletions terraform/infrastructure/s940/prod/acr/.env.template
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ key="acr/terraform.tfstate" # dev.radixtfexample.terraform.tfstate
# Configure the Microsoft Azure Provider

# service principal client_id
client_id="043e5510-738f-4c30-8b9d-ee32578c7fe8" # ar-radix-platform-github-platform-cluster-maintenance
client_id="043e5510-738f-4c30-8b9d-ee32578c7fe8" # OP-Terraform-Github Action

# service principal client_secret
client_secret="" # ar-radix-platform-github-platform-cluster-maintenance secret
client_secret="" # OP-Terraform-Github Action secret

subscription_id="ded7ca41-37c8-4085-862f-b11d21ab341a" # S940-Omnia-Radix-Production
tenant_id="3aa4a235-b6e2-48d5-9195-7fcf05b459b0"
Expand Down
4 changes: 2 additions & 2 deletions terraform/infrastructure/s940/prod/keyvaults/.env.template
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ key="keyvaults/terraform.tfstate"
# Configure the Microsoft Azure Provider

# service principal client_id
client_id="043e5510-738f-4c30-8b9d-ee32578c7fe8" # ar-radix-platform-github-platform-cluster-maintenance
client_id="043e5510-738f-4c30-8b9d-ee32578c7fe8" # OP-Terraform-Github Action

# service principal client_secret
client_secret="" # ar-radix-platform-github-platform-cluster-maintenance secret
client_secret="" # OP-Terraform-Github Action secret

subscription_id="ded7ca41-37c8-4085-862f-b11d21ab341a" # S940-Omnia-Radix-Production
tenant_id="3aa4a235-b6e2-48d5-9195-7fcf05b459b0"
4 changes: 2 additions & 2 deletions terraform/infrastructure/s940/prod/logicapps/.env.template
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ key="logicapps/terraform.tfstate"
# Configure the Microsoft Azure Provider

# service principal client_id
client_id="043e5510-738f-4c30-8b9d-ee32578c7fe8" # ar-radix-platform-github-platform-cluster-maintenance
client_id="043e5510-738f-4c30-8b9d-ee32578c7fe8" # OP-Terraform-Github Action

# service principal client_secret
client_secret="" # ar-radix-platform-github-platform-cluster-maintenance secret
client_secret="" # OP-Terraform-Github Action secret

subscription_id="ded7ca41-37c8-4085-862f-b11d21ab341a" # S940-Omnia-Radix-Production
tenant_id="3aa4a235-b6e2-48d5-9195-7fcf05b459b0"
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ key="managedidentity/terraform.tfstate"
# Configure the Microsoft Azure Provider

# service principal client_id
client_id="043e5510-738f-4c30-8b9d-ee32578c7fe8" # ar-radix-platform-github-platform-cluster-maintenance
client_id="043e5510-738f-4c30-8b9d-ee32578c7fe8" # OP-Terraform-Github Action

# service principal client_secret
client_secret="" # ar-radix-platform-github-platform-cluster-maintenance secret
client_secret="" # OP-Terraform-Github Action secret

subscription_id="ded7ca41-37c8-4085-862f-b11d21ab341a" # S940-Omnia-Radix-Production
tenant_id="3aa4a235-b6e2-48d5-9195-7fcf05b459b0"
4 changes: 2 additions & 2 deletions terraform/infrastructure/s940/prod/mysql/.env.template
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ key="mysql/terraform.tfstate"
# Configure the Microsoft Azure Provider

# service principal client_id
client_id="043e5510-738f-4c30-8b9d-ee32578c7fe8" # ar-radix-platform-github-platform-cluster-maintenance
client_id="043e5510-738f-4c30-8b9d-ee32578c7fe8" # OP-Terraform-Github Action

# service principal client_secret
client_secret="" # ar-radix-platform-github-platform-cluster-maintenance secret
client_secret="" # OP-Terraform-Github Action secret

subscription_id="ded7ca41-37c8-4085-862f-b11d21ab341a" # S940-Omnia-Radix-Production
tenant_id="3aa4a235-b6e2-48d5-9195-7fcf05b459b0"
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ key="networkmanager/terraform.tfstate"
client_id="043e5510-738f-4c30-8b9d-ee32578c7fe8" # OP-Terraform-Github Action

# service principal client_secret
client_secret="" # ar-radix-platform-github-platform-cluster-maintenance secret
client_secret="" # OP-Terraform-Github Action secret

subscription_id="ded7ca41-37c8-4085-862f-b11d21ab341a" # S940-Omnia-Radix-Production
tenant_id="3aa4a235-b6e2-48d5-9195-7fcf05b459b0"
2 changes: 1 addition & 1 deletion terraform/infrastructure/s940/prod/policy/.env.template
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ key="policy/terraform.tfstate"
client_id="043e5510-738f-4c30-8b9d-ee32578c7fe8" # OP-Terraform-Github Action

# service principal client_secret
client_secret="" # ar-radix-platform-github-platform-cluster-maintenance secret
client_secret="" # OP-Terraform-Github Action secret

subscription_id="ded7ca41-37c8-4085-862f-b11d21ab341a" # S940-Omnia-Radix-Production
tenant_id="3aa4a235-b6e2-48d5-9195-7fcf05b459b0"
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ key="resourcegroups/terraform.tfstate" # dev.radixtfexample.terraform.tfstate
# Configure the Microsoft Azure Provider

# service principal client_id
client_id="043e5510-738f-4c30-8b9d-ee32578c7fe8" # ar-radix-platform-github-platform-cluster-maintenance
client_id="043e5510-738f-4c30-8b9d-ee32578c7fe8" # OP-Terraform-Github Action

# service principal client_secret
client_secret="" # ar-radix-platform-github-dev-cluster-maintenance secret
Expand Down
4 changes: 2 additions & 2 deletions terraform/infrastructure/s940/prod/sqldatabases/.env.template
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ key="sqldatabase/terraform.tfstate"
# Configure the Microsoft Azure Provider

# service principal client_id
client_id="043e5510-738f-4c30-8b9d-ee32578c7fe8" # ar-radix-platform-github-platform-cluster-maintenance
client_id="043e5510-738f-4c30-8b9d-ee32578c7fe8" # OP-Terraform-Github Action

# service principal client_secret
client_secret="" # ar-radix-platform-github-platform-cluster-maintenance secret
client_secret="" # OP-Terraform-Github Action secret

subscription_id="ded7ca41-37c8-4085-862f-b11d21ab341a" # S940-Omnia-Radix-Production
tenant_id="3aa4a235-b6e2-48d5-9195-7fcf05b459b0"
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ key="storageaccounts/terraform.tfstate" # dev.radixtfexample.terraform.tfstate
# Configure the Microsoft Azure Provider

# service principal client_id
client_id="043e5510-738f-4c30-8b9d-ee32578c7fe8" # ar-radix-platform-github-platform-cluster-maintenance
client_id="043e5510-738f-4c30-8b9d-ee32578c7fe8" # OP-Terraform-Github Action

# service principal client_secret
client_secret="" # ar-radix-platform-github-dev-cluster-maintenance secret
Expand Down
4 changes: 2 additions & 2 deletions terraform/infrastructure/s940/prod/storageaccounts/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ locals {
}

data "azurerm_key_vault" "keyvault_env" {
name = "radix-vault-${var.RADIX_ZONE}"
name = var.KV_RADIX_VAULT
resource_group_name = var.AZ_RESOURCE_GROUP_COMMON
}

data "azurerm_key_vault_secret" "whitelist_ips" {
name = "acr-whitelist-sa-${var.RADIX_ZONE}"
name = "acr-whitelist-ips-${var.RADIX_ZONE}"
key_vault_id = data.azurerm_key_vault.keyvault_env.id
}

Expand Down
17 changes: 11 additions & 6 deletions terraform/infrastructure/s940/prod/storageaccounts/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ variable "storage_accounts" {
default = {}
}

variable "resource_groups" {
type = map(object({
name = string # Mandatory
location = optional(string, "northeurope") # Optional
}))
default = {}
}

variable "virtual_networks" {
type = map(object({
name = optional(string, "vnet-hub")
Expand All @@ -68,10 +76,7 @@ variable "private_link" {
default = null
}

variable "resource_groups" {
type = map(object({
name = string # Mandatory
location = optional(string, "northeurope") # Optional
}))
default = {}
variable "KV_RADIX_VAULT" {
description = "Radix keyvault"
type = string
}
20 changes: 20 additions & 0 deletions terraform/infrastructure/s941/dev/storageaccounts/.env.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
## For local development: copy this file, rename it to `backend_config.env`, and populate accordingly

resource_group_name="s941-tfstate"
storage_account_name ="s941radixinfra"
container_name="infrastructure"
use_azuread_auth=true

# tfstate name
key="storageaccounts/terraform.tfstate" # dev.radixtfexample.terraform.tfstate

# Configure the Microsoft Azure Provider

# service principal client_id
client_id="f1e6bc52-9aa4-4ca7-a9ac-b7a19d8f0f86" # ar-radix-platform-github-dev-cluster-maintenance

# service principal client_secret
client_secret="" # ar-radix-platform-github-dev-cluster-maintenance secret

subscription_id="16ede44b-1f74-40a5-b428-46cca9a5741b" # S941-Omnia-Radix-Development
tenant_id="3aa4a235-b6e2-48d5-9195-7fcf05b459b0"
4 changes: 2 additions & 2 deletions terraform/infrastructure/s941/dev/storageaccounts/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ locals {
}

data "azurerm_key_vault" "keyvault_env" {
name = "radix-vault-${var.RADIX_ZONE}"
name = var.KV_RADIX_VAULT
resource_group_name = var.AZ_RESOURCE_GROUP_COMMON
}

data "azurerm_key_vault_secret" "whitelist_ips" {
name = "acr-whitelist-sa-${var.RADIX_ZONE}"
name = "acr-whitelist-ips-${var.RADIX_ZONE}"
key_vault_id = data.azurerm_key_vault.keyvault_env.id
}

Expand Down
17 changes: 11 additions & 6 deletions terraform/infrastructure/s941/dev/storageaccounts/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ variable "storage_accounts" {
default = {}
}

variable "resource_groups" {
type = map(object({
name = string # Mandatory
location = optional(string, "northeurope") # Optional
}))
default = {}
}

variable "virtual_networks" {
type = map(object({
name = optional(string, "vnet-hub")
Expand All @@ -68,10 +76,7 @@ variable "private_link" {
default = null
}

variable "resource_groups" {
type = map(object({
name = string # Mandatory
location = optional(string, "northeurope") # Optional
}))
default = {}
variable "KV_RADIX_VAULT" {
description = "Radix keyvault"
type = string
}

0 comments on commit 0ce3e99

Please sign in to comment.