-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
terraform config for Vulnerability Scanner in C2 + Prod (#1173)
* terraform config for Vulnerability Scanner in C2 + Prod * bugfix c2 * added cost-allocation to terraform * added cost-allocation to terraform in playground * update cost allocation and vulnerability scanner in c2, platform, dev & playground * add tenant summary script * handle prod/platform special case * handle prod/platform special case * terraform fmt * handle cost allocation in c2, update mi in prod * update mi name in cost allocation in dev and playground * update mi name in vulnerability can in dev and playground
- Loading branch information
Showing
28 changed files
with
584 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
terraform/subscriptions/s940/c2/cost-allocation/backend.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
terraform { | ||
required_providers { | ||
azurerm = { | ||
source = "hashicorp/azurerm" | ||
version = "<=3.69.0" | ||
} | ||
} | ||
|
||
backend "azurerm" { | ||
tenant_id = "3aa4a235-b6e2-48d5-9195-7fcf05b459b0" | ||
subscription_id = "ded7ca41-37c8-4085-862f-b11d21ab341a" | ||
resource_group_name = "s940-tfstate" | ||
storage_account_name = "s940radixinfra" | ||
container_name = "infrastructure" | ||
key = "c2/cost-allocation/terraform.tfstate" | ||
} | ||
} | ||
|
||
provider "azurerm" { | ||
subscription_id = "ded7ca41-37c8-4085-862f-b11d21ab341a" | ||
features { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
module "config" { | ||
source = "../../../modules/config" | ||
} | ||
|
||
module "resourcegroup" { | ||
source = "../../../modules/resourcegroups" | ||
name = "cost-allocation-${module.config.environment}" | ||
location = module.config.location | ||
} | ||
data "azurerm_key_vault" "keyvault" { | ||
name = module.config.key_vault_name | ||
resource_group_name = module.config.common_resource_group | ||
} | ||
data "azurerm_key_vault_secret" "keyvault_secrets" { | ||
name = var.keyvault_dbadmin_secret_name | ||
key_vault_id = data.azurerm_key_vault.keyvault.id # local.external_outputs.keyvault.vault_id | ||
} | ||
|
||
# MS SQL Server | ||
module "mssql-database" { | ||
source = "../../../modules/mssqldatabase" | ||
env = module.config.environment | ||
managed_identity_admin_name = "radix-id-cost-allocation-admin-c2" | ||
database_name = "sqldb-radix-cost-allocation" | ||
server_name = "sql-radix-cost-allocation-${module.config.environment}-prod" # https://github.com/equinor/radix-platform/issues/1190 | ||
admin_adgroup = var.admin-adgroup | ||
administrator_login = "radix" | ||
administrator_password = data.azurerm_key_vault_secret.keyvault_secrets.value | ||
rg_name = module.resourcegroup.data.name | ||
vnet_resource_group = module.config.vnet_resource_group | ||
location = module.config.location | ||
public_network_access_enabled = true | ||
zone_redundant = false | ||
tags = { | ||
displayName = "SqlServer" | ||
} | ||
database_tags = { | ||
displayName = "Database" | ||
} | ||
|
||
admin_federated_credentials = { | ||
github-master = { | ||
issuer = "https://token.actions.githubusercontent.com" | ||
subject = "repo:equinor/radix-cost-allocation:ref:refs/heads/master" | ||
} | ||
github-release = { | ||
issuer = "https://token.actions.githubusercontent.com" | ||
subject = "repo:equinor/radix-cost-allocation:ref:refs/heads/release" | ||
} | ||
} | ||
} | ||
|
||
output "mi-client-id" { | ||
value = module.mssql-database.mi-admin | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
variable "admin-adgroup" { | ||
type = string | ||
default = "Radix SQL server admin - c2" | ||
} | ||
|
||
variable "keyvault_dbadmin_secret_name" { | ||
type = string | ||
default = "radix-cost-allocation-db-admin" | ||
} |
23 changes: 23 additions & 0 deletions
23
terraform/subscriptions/s940/c2/vulnerability-scanner/backend.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
terraform { | ||
required_providers { | ||
azurerm = { | ||
source = "hashicorp/azurerm" | ||
version = "<=3.69.0" | ||
} | ||
} | ||
|
||
backend "azurerm" { | ||
tenant_id = "3aa4a235-b6e2-48d5-9195-7fcf05b459b0" | ||
subscription_id = "ded7ca41-37c8-4085-862f-b11d21ab341a" | ||
resource_group_name = "s940-tfstate" | ||
storage_account_name = "s940radixinfra" | ||
container_name = "infrastructure" | ||
key = "c2/vulnerability-scan/terraform.tfstate" | ||
} | ||
} | ||
|
||
provider "azurerm" { | ||
subscription_id = "ded7ca41-37c8-4085-862f-b11d21ab341a" | ||
features { | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
terraform/subscriptions/s940/c2/vulnerability-scanner/main.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
module "config" { | ||
source = "../../../modules/config" | ||
} | ||
module "resourcegroup" { | ||
source = "../../../modules/resourcegroups" | ||
name = "vulnerability-scan-${module.config.environment}" | ||
location = module.config.location | ||
} | ||
data "azurerm_key_vault" "keyvault" { | ||
name = module.config.key_vault_name | ||
resource_group_name = module.config.common_resource_group | ||
} | ||
data "azurerm_key_vault_secret" "keyvault_secrets" { | ||
name = var.keyvault_dbadmin_secret_name | ||
key_vault_id = data.azurerm_key_vault.keyvault.id | ||
} | ||
|
||
# MS SQL Server | ||
module "mssql-database" { | ||
source = "../../../modules/mssqldatabase" | ||
env = module.config.environment | ||
managed_identity_admin_name = "radix-id-vulnerability-scan-admin-${module.config.environment}" | ||
database_name = "radix-vulnerability-scan" | ||
server_name = "sql-radix-vulnerability-scan-${module.config.environment}-prod" | ||
admin_adgroup = var.admin-adgroup | ||
administrator_login = "radix" | ||
administrator_password = data.azurerm_key_vault_secret.keyvault_secrets.value | ||
rg_name = module.resourcegroup.data.name | ||
vnet_resource_group = module.config.vnet_resource_group | ||
location = module.config.location | ||
public_network_access_enabled = true | ||
zone_redundant = false | ||
|
||
admin_federated_credentials = { | ||
github-master = { | ||
issuer = "https://token.actions.githubusercontent.com" | ||
subject = "repo:equinor/radix-vulnerability-scanner:ref:refs/heads/master" | ||
} | ||
github-release = { | ||
issuer = "https://token.actions.githubusercontent.com" | ||
subject = "repo:equinor/radix-vulnerability-scanner:ref:refs/heads/release" | ||
} | ||
} | ||
} | ||
|
||
output "mi-client-id" { | ||
value = module.mssql-database.mi-admin | ||
} |
9 changes: 9 additions & 0 deletions
9
terraform/subscriptions/s940/c2/vulnerability-scanner/variables.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
variable "admin-adgroup" { | ||
type = string | ||
default = "Radix SQL server admin - c2" | ||
} | ||
|
||
variable "keyvault_dbadmin_secret_name" { | ||
type = string | ||
default = "radix-vulnerability-scan-db-admin" | ||
} |
23 changes: 23 additions & 0 deletions
23
terraform/subscriptions/s940/prod/cost-allocation/backend.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
terraform { | ||
required_providers { | ||
azurerm = { | ||
source = "hashicorp/azurerm" | ||
version = "<=3.69.0" | ||
} | ||
} | ||
|
||
backend "azurerm" { | ||
tenant_id = "3aa4a235-b6e2-48d5-9195-7fcf05b459b0" | ||
subscription_id = "ded7ca41-37c8-4085-862f-b11d21ab341a" | ||
resource_group_name = "s940-tfstate" | ||
storage_account_name = "s940radixinfra" | ||
container_name = "infrastructure" | ||
key = "prod/cost-allocation/terraform.tfstate" | ||
} | ||
} | ||
|
||
provider "azurerm" { | ||
subscription_id = "ded7ca41-37c8-4085-862f-b11d21ab341a" | ||
features { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
module "config" { | ||
source = "../../../modules/config" | ||
} | ||
|
||
module "resourcegroup" { | ||
source = "../../../modules/resourcegroups" | ||
name = "cost-allocation-${module.config.environment}" | ||
location = module.config.location | ||
} | ||
data "azurerm_key_vault" "keyvault" { | ||
name = module.config.key_vault_name | ||
resource_group_name = module.config.common_resource_group | ||
} | ||
data "azurerm_key_vault_secret" "keyvault_secrets" { | ||
name = var.keyvault_dbadmin_secret_name | ||
key_vault_id = data.azurerm_key_vault.keyvault.id # local.external_outputs.keyvault.vault_id | ||
} | ||
|
||
# MS SQL Server | ||
module "mssql-database" { | ||
source = "../../../modules/mssqldatabase" | ||
env = module.config.environment | ||
managed_identity_admin_name = "radix-id-cost-allocation-admin-platform" | ||
database_name = "sqldb-radix-cost-allocation" | ||
server_name = "sql-radix-cost-allocation-prod" # ${module.config.environment} # See https://github.com/equinor/radix-platform/issues/1186 | ||
admin_adgroup = var.admin-adgroup | ||
administrator_login = "radix" | ||
administrator_password = data.azurerm_key_vault_secret.keyvault_secrets.value | ||
rg_name = module.resourcegroup.data.name | ||
location = module.config.location | ||
vnet_resource_group = module.config.vnet_resource_group | ||
sku_name = "S3" | ||
public_network_access_enabled = false | ||
zone_redundant = false | ||
tags = { | ||
displayName = "SqlServer" | ||
} | ||
database_tags = { | ||
displayName = "Database" | ||
} | ||
|
||
admin_federated_credentials = { | ||
github-master = { | ||
issuer = "https://token.actions.githubusercontent.com" | ||
subject = "repo:equinor/radix-cost-allocation:ref:refs/heads/master" | ||
} | ||
github-release = { | ||
issuer = "https://token.actions.githubusercontent.com" | ||
subject = "repo:equinor/radix-cost-allocation:ref:refs/heads/release" | ||
} | ||
} | ||
} | ||
|
||
output "mi-client-id" { | ||
value = module.mssql-database.mi-admin | ||
} |
9 changes: 9 additions & 0 deletions
9
terraform/subscriptions/s940/prod/cost-allocation/variables.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
variable "admin-adgroup" { | ||
type = string | ||
default = "Radix SQL server admin - platform" | ||
} | ||
|
||
variable "keyvault_dbadmin_secret_name" { | ||
type = string | ||
default = "radix-cost-allocation-db-admin" | ||
} |
23 changes: 23 additions & 0 deletions
23
terraform/subscriptions/s940/prod/vulnerability-scanner/backend.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
terraform { | ||
required_providers { | ||
azurerm = { | ||
source = "hashicorp/azurerm" | ||
version = "<=3.69.0" | ||
} | ||
} | ||
|
||
backend "azurerm" { | ||
tenant_id = "3aa4a235-b6e2-48d5-9195-7fcf05b459b0" | ||
subscription_id = "ded7ca41-37c8-4085-862f-b11d21ab341a" | ||
resource_group_name = "s940-tfstate" | ||
storage_account_name = "s940radixinfra" | ||
container_name = "infrastructure" | ||
key = "prod/vulnerability-scan/terraform.tfstate" | ||
} | ||
} | ||
|
||
provider "azurerm" { | ||
subscription_id = "ded7ca41-37c8-4085-862f-b11d21ab341a" | ||
features { | ||
} | ||
} |
Oops, something went wrong.