From 802b14ec9a5652d6a2a4d0f6faaf7b29db957a9b Mon Sep 17 00:00:00 2001 From: Derek A Dombek <50093944+derekadombek@users.noreply.github.com> Date: Wed, 16 Oct 2024 15:00:47 -0600 Subject: [PATCH] Terraform variable clean-up and creation (#317) * Terraform variable clean-up and creation * wip * - * add different env configs for state * rm non-used vars * wip * wip * add networking vars --------- Co-authored-by: Administrator --- ops/terraform/config/dev.config | 4 ++ ops/terraform/config/dev2.config | 4 ++ ops/terraform/config/dev3.config | 4 ++ ops/terraform/config/dev4.config | 4 ++ ops/terraform/config/dev5.config | 4 ++ ops/terraform/config/dev6.config | 4 ++ ops/terraform/data.tf | 2 +- ops/terraform/locals.tf | 58 ++++++++++++++----- ops/terraform/main.tf | 54 +++++++++-------- ops/terraform/modules/app_gateway/main.tf | 52 ++++++++--------- .../modules/app_gateway/variables.tf | 5 +- ops/terraform/modules/app_service/main.tf | 9 +-- .../modules/app_service/variables.tf | 8 +-- ops/terraform/modules/compute/variables.tf | 1 + .../modules/container_instances/main.tf | 2 +- .../modules/container_instances/variables.tf | 1 + ops/terraform/modules/network/main.tf | 44 +++++++------- ops/terraform/modules/network/outputs.tf | 13 ++--- ops/terraform/modules/network/variables.tf | 4 +- ops/terraform/modules/security/main.tf | 2 +- ops/terraform/modules/security/variables.tf | 4 +- ops/terraform/modules/storage/main.tf | 2 +- ops/terraform/modules/storage/variables.tf | 1 + ops/terraform/providers.tf | 3 - ops/terraform/variables.tf | 7 +-- 25 files changed, 166 insertions(+), 130 deletions(-) create mode 100644 ops/terraform/config/dev.config create mode 100644 ops/terraform/config/dev2.config create mode 100644 ops/terraform/config/dev3.config create mode 100644 ops/terraform/config/dev4.config create mode 100644 ops/terraform/config/dev5.config create mode 100644 ops/terraform/config/dev6.config diff --git a/ops/terraform/config/dev.config b/ops/terraform/config/dev.config new file mode 100644 index 00000000..bf40ffa5 --- /dev/null +++ b/ops/terraform/config/dev.config @@ -0,0 +1,4 @@ + storage_account_name = "tfstaterv2024" + container_name = "rv-tfstate" + key = "dev.terraform.tfstate" + use_oidc = true \ No newline at end of file diff --git a/ops/terraform/config/dev2.config b/ops/terraform/config/dev2.config new file mode 100644 index 00000000..c6eec405 --- /dev/null +++ b/ops/terraform/config/dev2.config @@ -0,0 +1,4 @@ + storage_account_name = "tfstaterv2024" + container_name = "rv-tfstate" + key = "dev2.terraform.tfstate" + use_oidc = true \ No newline at end of file diff --git a/ops/terraform/config/dev3.config b/ops/terraform/config/dev3.config new file mode 100644 index 00000000..4d8b1b16 --- /dev/null +++ b/ops/terraform/config/dev3.config @@ -0,0 +1,4 @@ + storage_account_name = "tfstaterv2024" + container_name = "rv-tfstate" + key = "dev3.terraform.tfstate" + use_oidc = true \ No newline at end of file diff --git a/ops/terraform/config/dev4.config b/ops/terraform/config/dev4.config new file mode 100644 index 00000000..85638aa5 --- /dev/null +++ b/ops/terraform/config/dev4.config @@ -0,0 +1,4 @@ + storage_account_name = "tfstaterv2024" + container_name = "rv-tfstate" + key = "dev4.terraform.tfstate" + use_oidc = true \ No newline at end of file diff --git a/ops/terraform/config/dev5.config b/ops/terraform/config/dev5.config new file mode 100644 index 00000000..1889dabc --- /dev/null +++ b/ops/terraform/config/dev5.config @@ -0,0 +1,4 @@ + storage_account_name = "tfstaterv2024" + container_name = "rv-tfstate" + key = "dev5.terraform.tfstate" + use_oidc = true \ No newline at end of file diff --git a/ops/terraform/config/dev6.config b/ops/terraform/config/dev6.config new file mode 100644 index 00000000..7b84985d --- /dev/null +++ b/ops/terraform/config/dev6.config @@ -0,0 +1,4 @@ + storage_account_name = "tfstaterv2024" + container_name = "rv-tfstate" + key = "dev6.terraform.tfstate" + use_oidc = true \ No newline at end of file diff --git a/ops/terraform/data.tf b/ops/terraform/data.tf index b3cd8975..641213c6 100644 --- a/ops/terraform/data.tf +++ b/ops/terraform/data.tf @@ -1,3 +1,3 @@ -data "azurerm_resource_group" "dev" { +data "azurerm_resource_group" "rg" { name = var.resource_group_name } \ No newline at end of file diff --git a/ops/terraform/locals.tf b/ops/terraform/locals.tf index 5a609c97..d42f56af 100644 --- a/ops/terraform/locals.tf +++ b/ops/terraform/locals.tf @@ -2,24 +2,54 @@ locals { environment = "${terraform.workspace}" init = { environment = local.environment - resource_group_name = "reportvision-rg-${terraform.workspace}" location = "eastus2" } - network = { - config = { + dev = { + dev = { vnetcidr = "10.0.0.0/16" - websubnetcidr = "10.0.1.0/24" - appsubnetcidr = "10.0.2.0/24" - dbsubnetcidr = "10.0.3.0/24" - lbsubnetcidr = "10.0.4.0/24" + appsubnetcidr = "10.0.1.0/24" + websubnetcidr = "10.0.2.0/24" + lbsubnetcidr = "10.0.2.0/24" } } - app = { - web_host_name = "webserver" - web_username = "web_user" - web_os_password = "@Webuser1" - app_host_name = "appserver" - app_username = "app_user" - app_os_password = "@Appuser1" + dev2 = { + dev2 = { + vnetcidr = "10.2.0.0/16" + appsubnetcidr = "10.2.1.0/24" + websubnetcidr = "10.2.2.0/24" + lbsubnetcidr = "10.2.3.0/24" + } + } + dev3 = { + dev3 = { + vnetcidr = "10.3.0.0/16" + appsubnetcidr = "10.3.1.0/24" + websubnetcidr = "10.3.2.0/24" + lbsubnetcidr = "10.3.3.0/24" + } + } + dev4 = { + dev4 = { + vnetcidr = "10.4.0.0/16" + appsubnetcidr = "10.4.1.0/24" + websubnetcidr = "10.4.2.0/24" + lbsubnetcidr = "10.4.3.0/24" + } + } + dev5 = { + dev5 = { + vnetcidr = "10.5.0.0/16" + appsubnetcidr = "10.5.1.0/24" + websubnetcidr = "10.5.2.0/24" + lbsubnetcidr = "10.5.3.0/24" + } + } + dev6 = { + dev6 = { + vnetcidr = "10.6.0.0/16" + appsubnetcidr = "10.6.1.0/24" + websubnetcidr = "10.6.2.0/24" + lbsubnetcidr = "10.6.3.0/24" + } } } \ No newline at end of file diff --git a/ops/terraform/main.tf b/ops/terraform/main.tf index 03cf19c8..88dc80ce 100644 --- a/ops/terraform/main.tf +++ b/ops/terraform/main.tf @@ -1,7 +1,10 @@ locals { + workspaces = "${merge(local.dev, local.dev2, local.dev3, local.dev4, local.dev5, local.dev6)}" + workspace = "${local.workspaces[terraform.workspace]}" + management_tags = { environment = local.environment - resource_group = data.azurerm_resource_group.dev.name + resource_group = data.azurerm_resource_group.rg.name } } @@ -10,13 +13,13 @@ locals { ########## module "networking" { source = "./modules/network" - location = data.azurerm_resource_group.dev.location - resource_group = data.azurerm_resource_group.dev.name - vnetcidr = local.network.config.vnetcidr - websubnetcidr = local.network.config.websubnetcidr - appsubnetcidr = local.network.config.appsubnetcidr - lbsubnetcidr = local.network.config.lbsubnetcidr - dbsubnetcidr = local.network.config.dbsubnetcidr + name = var.name + location = data.azurerm_resource_group.rg.location + resource_group = data.azurerm_resource_group.rg.name + vnetcidr = local.workspace["vnetcidr"] + websubnetcidr = local.workspace["websubnetcidr"] + lbsubnetcidr = local.workspace["lbsubnetcidr"] + # dbsubnetcidr = local.network.config.dbsubnetcidr env = local.environment } @@ -26,19 +29,20 @@ module "networking" { module "securitygroup" { source = "./modules/security" - location = data.azurerm_resource_group.dev.location - resource_group = data.azurerm_resource_group.dev.name + name = var.name + location = data.azurerm_resource_group.rg.location + resource_group = data.azurerm_resource_group.rg.name web_subnet_id = module.networking.websubnet_id - app_subnet_id = module.networking.appsubnet_id - db_subnet_id = module.networking.dbsubnet_id + # db_subnet_id = module.networking.dbsubnet_id lb_subnet_id = module.networking.lbsubnet_id env = local.environment } module "app_gateway" { source = "./modules/app_gateway" - resource_group_location = data.azurerm_resource_group.dev.location - resource_group_name = data.azurerm_resource_group.dev.name + name = var.name + resource_group_location = data.azurerm_resource_group.rg.location + resource_group_name = data.azurerm_resource_group.rg.name blob_endpoint = module.storage.primary_web_host web-subnet = module.networking.lbsubnet_id @@ -55,8 +59,9 @@ module "app_gateway" { module "storage" { source = "./modules/storage" - location = data.azurerm_resource_group.dev.location - resource_group = data.azurerm_resource_group.dev.name + name = var.name + location = data.azurerm_resource_group.rg.location + resource_group = data.azurerm_resource_group.rg.name env = local.environment management_tags = local.management_tags app_gateway_ip = module.app_gateway.app_gateway_ip @@ -68,18 +73,19 @@ module "storage" { ########## module "ocr_api" { - source = "./modules/app_service" - location = local.init.location - resource_group = data.azurerm_resource_group.dev.name - app_subnet_id = module.networking.lbsubnet_id - env = local.environment - vnet = module.networking.network_name + source = "./modules/app_service" + name = var.name + location = local.init.location + resource_group = data.azurerm_resource_group.rg.name + app_subnet_id = module.networking.lbsubnet_id + env = local.environment + vnet = module.networking.network_name } # module "compute" { # source = "./modules/container_instances" -# location = data.azurerm_resource_group.test.location -# resource_group = data.azurerm_resource_group.test.name +# location = data.azurerm_resource_group.rg.location +# resource_group = data.azurerm_resource_group.rg.name # environment = local.environment # app_subnet = module.networking.appsubnet_id # # web_subnet_id = module.networking.websubnet_id diff --git a/ops/terraform/modules/app_gateway/main.tf b/ops/terraform/modules/app_gateway/main.tf index c69d9b20..d003c710 100644 --- a/ops/terraform/modules/app_gateway/main.tf +++ b/ops/terraform/modules/app_gateway/main.tf @@ -1,5 +1,5 @@ resource "azurerm_public_ip" "lb-pip" { - name = "reportvision-pip-lb-${var.env}" + name = "${var.name}-pip-lb-${var.env}" resource_group_name = var.resource_group_name location = var.resource_group_location allocation_method = "Static" @@ -10,25 +10,25 @@ resource "azurerm_public_ip" "lb-pip" { # since these variables are re-used - a locals block makes this more maintainable locals { - backend_address_pool_name_static = "${var.vnet-name}-beap-static" - backend_address_pool_name_api = "${var.vnet-name}-beap-api" - frontend_port_name_api = "${var.vnet-name}-feport-api" - frontend_port_name_static = "${var.vnet-name}-feport-static" - frontend_ip_configuration_name = "${var.vnet-name}-feip" - http_setting_name_static = "${var.vnet-name}-be-htst-static" - http_setting_name_api = "${var.vnet-name}-be-htst-api" - listener_name_static = "${var.vnet-name}-httplstn-static" - listener_name_api = "${var.vnet-name}-httplstn-api" - request_routing_rule_name_api = "${var.vnet-name}-rqrt-api" - request_routing_rule_name_static = "${var.vnet-name}-rqrt-static" - redirect_configuration_name = "${var.vnet-name}-rdrcfg" - static_probe_name_app = "${var.vnet-name}-be-probe-app-static" - api_probe_name_app = "${var.vnet-name}-be-probe-app-api" - redirect_rule = "${var.vnet-name}-redirect" + backend_address_pool_name_static = "${var.name}-${var.env}-beap-static" + backend_address_pool_name_api = "${var.name}-${var.env}-beap-api" + frontend_port_name_api = "${var.name}-${var.env}-feport-api" + frontend_port_name_static = "${var.name}-${var.env}-feport-static" + frontend_ip_configuration_name = "${var.name}-${var.env}-feip" + http_setting_name_static = "${var.name}-${var.env}-be-htst-static" + http_setting_name_api = "${var.name}-${var.env}-be-htst-api" + listener_name_static = "${var.name}-${var.env}-httplstn-static" + listener_name_api = "${var.name}-${var.env}-httplstn-api" + request_routing_rule_name_api = "${var.name}-${var.env}-rqrt-api" + request_routing_rule_name_static = "${var.name}-${var.env}-rqrt-static" + redirect_configuration_name = "${var.name}-${var.env}-rdrcfg" + static_probe_name_app = "${var.name}-${var.env}-be-probe-app-static" + api_probe_name_app = "${var.name}-${var.env}-be-probe-app-api" + redirect_rule = "${var.name}-${var.env}-redirect" } resource "azurerm_application_gateway" "load_balancer" { - name = "reportvision-appgateway-${var.env}" + name = "${var.name}-appgateway-${var.env}" resource_group_name = var.resource_group_name location = var.resource_group_location @@ -39,7 +39,7 @@ resource "azurerm_application_gateway" "load_balancer" { } gateway_ip_configuration { - name = "reportvision-gateway-ip-configuration" + name = "${var.name}-gateway-ip-configuration" subnet_id = var.web-subnet } @@ -55,7 +55,6 @@ resource "azurerm_application_gateway" "load_balancer" { port = 80 protocol = "Http" request_timeout = 60 - path = "/" pick_host_name_from_backend_address = true probe_name = local.static_probe_name_app } @@ -84,7 +83,6 @@ resource "azurerm_application_gateway" "load_balancer" { port = 80 protocol = "Http" request_timeout = 120 - path = "/api" pick_host_name_from_backend_address = true probe_name = local.api_probe_name_app } @@ -154,31 +152,31 @@ resource "azurerm_application_gateway" "load_balancer" { url_path_map { - name = "${var.vnet-name}-urlmap" + name = "${var.name}-${var.env}-urlmap" default_backend_address_pool_name = local.backend_address_pool_name_static default_backend_http_settings_name = local.http_setting_name_static - default_rewrite_rule_set_name = "mde-routing" + default_rewrite_rule_set_name = "${var.name}-routing" path_rule { name = "api" - paths = ["/api/*", "/api"] + paths = ["/ocr-api/*", "/ocr-api"] backend_address_pool_name = local.backend_address_pool_name_api backend_http_settings_name = local.http_setting_name_api // this is the default, why would we set it again? // because if we don't do this we get 404s on API calls - rewrite_rule_set_name = "mde-routing" + rewrite_rule_set_name = "${var.name}-routing" } } rewrite_rule_set { - name = "mde-routing" + name = "${var.name}-routing" rewrite_rule { - name = "api-wildcard" + name = "ocr-api-wildcard" rule_sequence = 101 condition { ignore_case = true negate = false - pattern = ".*api/(.*)" + pattern = ".*ocr-api/(.*)" variable = "var_uri_path" } diff --git a/ops/terraform/modules/app_gateway/variables.tf b/ops/terraform/modules/app_gateway/variables.tf index 4aa71b84..a4bf2bad 100644 --- a/ops/terraform/modules/app_gateway/variables.tf +++ b/ops/terraform/modules/app_gateway/variables.tf @@ -1,7 +1,4 @@ -variable "vnet-name" { - type = string - default = "reportvision-dev" -} +variable "name" {} variable "resource_group_name" {} variable "resource_group_location" {} variable "web-subnet" {} diff --git a/ops/terraform/modules/app_service/main.tf b/ops/terraform/modules/app_service/main.tf index 19a03ce8..6b2ddb02 100644 --- a/ops/terraform/modules/app_service/main.tf +++ b/ops/terraform/modules/app_service/main.tf @@ -3,7 +3,7 @@ locals { } resource "azurerm_service_plan" "asp" { - name = "${var.name_ocr}-appserviceplan-${var.env}" + name = "${var.name}-ocr-appserviceplan-${var.env}" location = var.location os_type = "Linux" resource_group_name = var.resource_group @@ -11,7 +11,7 @@ resource "azurerm_service_plan" "asp" { } resource "azurerm_linux_web_app" "linux_webapp" { - name = "${var.name_ocr}-${var.env}" + name = "${var.name}-ocr-${var.env}" https_only = var.https_only location = var.location resource_group_name = var.resource_group @@ -33,11 +33,6 @@ resource "azurerm_linux_web_app" "linux_webapp" { ftps_state = "Disabled" vnet_route_all_enabled = false - # application_stack { - # docker_image_name = "cdcgov/reportvision-ocr-api:derek-main-dev" - # docker_registry_url = "https://ghcr.io" - # } - ip_restriction { virtual_network_subnet_id = var.app_subnet_id action = "Allow" diff --git a/ops/terraform/modules/app_service/variables.tf b/ops/terraform/modules/app_service/variables.tf index b81b4571..9105a884 100644 --- a/ops/terraform/modules/app_service/variables.tf +++ b/ops/terraform/modules/app_service/variables.tf @@ -1,17 +1,13 @@ variable "env" {} +variable "name" {} variable "resource_group" {} variable "location" {} -variable "name_ocr" { - default = "reportvision-ocr-api" -} + variable "app_subnet_id" {} variable "sku_name" { default = "P1v3" } -variable "az_account" { - default = "reportvision" -} variable "https_only" { type = bool diff --git a/ops/terraform/modules/compute/variables.tf b/ops/terraform/modules/compute/variables.tf index aaf0435b..3e19fd1c 100644 --- a/ops/terraform/modules/compute/variables.tf +++ b/ops/terraform/modules/compute/variables.tf @@ -1,4 +1,5 @@ variable "resource_group" {} +variable "name" {} variable "location" {} variable "web_subnet_id" {} variable "app_subnet_id" {} diff --git a/ops/terraform/modules/container_instances/main.tf b/ops/terraform/modules/container_instances/main.tf index ea537a53..55a7c742 100644 --- a/ops/terraform/modules/container_instances/main.tf +++ b/ops/terraform/modules/container_instances/main.tf @@ -1,5 +1,5 @@ resource "azurerm_container_group" "example" { - name = "reportvision-ocr" + name = "${var.name}-cg" location = var.location resource_group_name = var.resource_group ip_address_type = "Private" diff --git a/ops/terraform/modules/container_instances/variables.tf b/ops/terraform/modules/container_instances/variables.tf index 3c46a99f..95ad5d89 100644 --- a/ops/terraform/modules/container_instances/variables.tf +++ b/ops/terraform/modules/container_instances/variables.tf @@ -1,4 +1,5 @@ variable "environment" {} +variable "name" {} variable "resource_group" {} variable "location" {} variable "app_subnet" {} \ No newline at end of file diff --git a/ops/terraform/modules/network/main.tf b/ops/terraform/modules/network/main.tf index ae2e1c07..56cd44dc 100644 --- a/ops/terraform/modules/network/main.tf +++ b/ops/terraform/modules/network/main.tf @@ -1,12 +1,12 @@ resource "azurerm_virtual_network" "vnet" { - name = "reportvision-vnet-${var.env}" + name = "${var.name}-vnet-${var.env}" resource_group_name = var.resource_group location = var.location address_space = [var.vnetcidr] } resource "azurerm_subnet" "web-subnet" { - name = "reportvision-web-subnet-${var.env}" + name = "${var.name}-web-subnet-${var.env}" virtual_network_name = azurerm_virtual_network.vnet.name resource_group_name = var.resource_group address_prefixes = [var.websubnetcidr] @@ -14,33 +14,33 @@ resource "azurerm_subnet" "web-subnet" { depends_on = [azurerm_virtual_network.vnet] } -resource "azurerm_subnet" "app-subnet" { - name = "reportvision-app-subnet-${var.env}" - virtual_network_name = azurerm_virtual_network.vnet.name - resource_group_name = var.resource_group - address_prefixes = [var.appsubnetcidr] +# resource "azurerm_subnet" "app-subnet" { +# name = "${var.name}-app-subnet-${var.env}" +# virtual_network_name = azurerm_virtual_network.vnet.name +# resource_group_name = var.resource_group +# address_prefixes = [var.appsubnetcidr] - delegation { - name = "delegation" +# delegation { +# name = "delegation" - service_delegation { - name = "Microsoft.ContainerInstance/containerGroups" - actions = ["Microsoft.Network/virtualNetworks/subnets/action"] - } - } -} +# service_delegation { +# name = "Microsoft.ContainerInstance/containerGroups" +# actions = ["Microsoft.Network/virtualNetworks/subnets/action"] +# } +# } +# } resource "azurerm_subnet" "lb-subnet" { - name = "reportvision-lb-subnet-${var.env}" + name = "${var.name}-lb-subnet-${var.env}" virtual_network_name = azurerm_virtual_network.vnet.name resource_group_name = var.resource_group address_prefixes = [var.lbsubnetcidr] depends_on = [azurerm_virtual_network.vnet] } -resource "azurerm_subnet" "db-subnet" { - name = "reportvision-db-subnet-${var.env}" - virtual_network_name = azurerm_virtual_network.vnet.name - resource_group_name = var.resource_group - address_prefixes = [var.dbsubnetcidr] -} \ No newline at end of file +# resource "azurerm_subnet" "db-subnet" { +# name = "${var.name}-db-subnet-${var.env}" +# virtual_network_name = azurerm_virtual_network.vnet.name +# resource_group_name = var.resource_group +# address_prefixes = [var.dbsubnetcidr] +# } \ No newline at end of file diff --git a/ops/terraform/modules/network/outputs.tf b/ops/terraform/modules/network/outputs.tf index 7880de2c..f3e6da98 100644 --- a/ops/terraform/modules/network/outputs.tf +++ b/ops/terraform/modules/network/outputs.tf @@ -8,15 +8,10 @@ output "websubnet_id" { description = "Id of websubnet in the network" } -output "appsubnet_id" { - value = azurerm_subnet.app-subnet.id - description = "Id of appsubnet in the network" -} - -output "dbsubnet_id" { - value = azurerm_subnet.db-subnet.id - description = "Id of dbsubnet in the network" -} +# output "dbsubnet_id" { +# value = azurerm_subnet.db-subnet.id +# description = "Id of dbsubnet in the network" +# } output "lbsubnet_id" { value = azurerm_subnet.lb-subnet.id diff --git a/ops/terraform/modules/network/variables.tf b/ops/terraform/modules/network/variables.tf index 4c14a078..301bbef4 100644 --- a/ops/terraform/modules/network/variables.tf +++ b/ops/terraform/modules/network/variables.tf @@ -1,8 +1,8 @@ variable "resource_group" {} +variable "name" {} variable "location" {} variable "vnetcidr" {} variable "websubnetcidr" {} -variable "appsubnetcidr" {} variable "lbsubnetcidr" {} -variable "dbsubnetcidr" {} +# variable "dbsubnetcidr" {} variable "env" {} \ No newline at end of file diff --git a/ops/terraform/modules/security/main.tf b/ops/terraform/modules/security/main.tf index 37f89977..260f69c5 100644 --- a/ops/terraform/modules/security/main.tf +++ b/ops/terraform/modules/security/main.tf @@ -1,5 +1,5 @@ resource "azurerm_network_security_group" "web-nsg" { - name = "reportvision-web-nsg-${var.env}" + name = "${var.name}-web-nsg-${var.env}" location = var.location resource_group_name = var.resource_group diff --git a/ops/terraform/modules/security/variables.tf b/ops/terraform/modules/security/variables.tf index 8b9fc986..9c62eaba 100644 --- a/ops/terraform/modules/security/variables.tf +++ b/ops/terraform/modules/security/variables.tf @@ -1,7 +1,7 @@ variable "location" {} +variable "name" {} variable "env" {} variable "resource_group" {} variable "web_subnet_id" {} -variable "app_subnet_id" {} -variable "db_subnet_id" {} +# variable "db_subnet_id" {} variable "lb_subnet_id" {} \ No newline at end of file diff --git a/ops/terraform/modules/storage/main.tf b/ops/terraform/modules/storage/main.tf index 1b3c8a18..67424e72 100644 --- a/ops/terraform/modules/storage/main.tf +++ b/ops/terraform/modules/storage/main.tf @@ -4,7 +4,7 @@ resource "azurerm_storage_account" "frontend" { account_kind = "StorageV2" location = var.location resource_group_name = var.resource_group - name = "reportvisionfrontend${var.env}" + name = "${var.name}frontend${var.env}" https_traffic_only_enabled = false static_website { diff --git a/ops/terraform/modules/storage/variables.tf b/ops/terraform/modules/storage/variables.tf index fd6d6edf..4ec3d4b0 100644 --- a/ops/terraform/modules/storage/variables.tf +++ b/ops/terraform/modules/storage/variables.tf @@ -1,4 +1,5 @@ variable "resource_group" {} +variable "name" {} variable "env" {} variable "location" {} variable "management_tags" {} diff --git a/ops/terraform/providers.tf b/ops/terraform/providers.tf index 20350122..554c8664 100644 --- a/ops/terraform/providers.tf +++ b/ops/terraform/providers.tf @@ -1,9 +1,6 @@ terraform { backend "azurerm" { resource_group_name = "reportvision-rg-global" - storage_account_name = "tfstaterv2024" - container_name = "rv-tfstate" - key = "dev/terraform.tfstate" } required_providers { azurerm = { diff --git a/ops/terraform/variables.tf b/ops/terraform/variables.tf index bdd404ad..860fea7d 100644 --- a/ops/terraform/variables.tf +++ b/ops/terraform/variables.tf @@ -2,10 +2,5 @@ variable "resource_group_name" { description = "value of the Azure resource group to deploy to" } -variable "subscription_id" { - description = "value of the Azure Subscription ID to use" -} - -variable "client_id" { - description = "Client ID" +variable "name" { } \ No newline at end of file