Skip to content

Commit

Permalink
Update tags to append DeploymentType in terraform (#422)
Browse files Browse the repository at this point in the history
  • Loading branch information
lisamurphy-msft authored Sep 22, 2021
1 parent ff7264a commit 5052d0f
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 78 deletions.
72 changes: 15 additions & 57 deletions src/terraform/mlz/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -138,43 +138,31 @@ resource "azurerm_resource_group" "hub" {

location = var.mlz_location
name = var.hub_rgname

tags = {
DeploymentName = var.deploymentname
}
}
tags = var.tags
}

resource "azurerm_resource_group" "tier0" {
provider = azurerm.tier0

location = var.mlz_location
name = var.tier0_rgname

tags = {
DeploymentName = var.deploymentname
}
tags = var.tags
}

resource "azurerm_resource_group" "tier1" {
provider = azurerm.tier1

location = var.mlz_location
name = var.tier1_rgname

tags = {
DeploymentName = var.deploymentname
}
tags = var.tags
}

resource "azurerm_resource_group" "tier2" {
provider = azurerm.tier2

location = var.mlz_location
name = var.tier2_rgname

tags = {
DeploymentName = var.deploymentname
}
tags = var.tags
}

################################
Expand All @@ -198,10 +186,7 @@ resource "azurerm_log_analytics_workspace" "laws" {
location = var.mlz_location
sku = "PerGB2018"
retention_in_days = "30"

tags = {
DeploymentName = var.deploymentname
}
tags = var.tags
}

resource "azurerm_log_analytics_solution" "laws_sentinel" {
Expand All @@ -218,10 +203,7 @@ resource "azurerm_log_analytics_solution" "laws_sentinel" {
publisher = "Microsoft"
product = "OMSGallery/SecurityInsights"
}

tags = {
DeploymentName = var.deploymentname
}
tags = var.tags
}

###############################
Expand All @@ -241,10 +223,7 @@ module "hub-network" {
management_address_space = var.hub_management_address_space

log_analytics_workspace_resource_id = azurerm_log_analytics_workspace.laws.id

tags = {
DeploymentName = var.deploymentname
}
tags = var.tags
}

module "firewall" {
Expand Down Expand Up @@ -272,10 +251,7 @@ module "firewall" {
management_publicip_name = var.management_publicip_name

log_analytics_workspace_resource_id = azurerm_log_analytics_workspace.laws.id

tags = {
DeploymentName = var.deploymentname
}
tags = var.tags
}

module "spoke-network-t0" {
Expand All @@ -295,10 +271,7 @@ module "spoke-network-t0" {
spoke_vnetname = var.tier0_vnetname
spoke_vnet_address_space = var.tier0_vnet_address_space
subnets = var.tier0_subnets

tags = {
DeploymentName = var.deploymentname
}
tags = var.tags
}

resource "azurerm_virtual_network_peering" "t0-to-hub" {
Expand Down Expand Up @@ -342,10 +315,7 @@ module "spoke-network-t1" {
spoke_vnetname = var.tier1_vnetname
spoke_vnet_address_space = var.tier1_vnet_address_space
subnets = var.tier1_subnets

tags = {
DeploymentName = var.deploymentname
}
tags = var.tags
}

resource "azurerm_virtual_network_peering" "t1-to-hub" {
Expand Down Expand Up @@ -389,10 +359,7 @@ module "spoke-network-t2" {
spoke_vnetname = var.tier2_vnetname
spoke_vnet_address_space = var.tier2_vnet_address_space
subnets = var.tier2_subnets

tags = {
DeploymentName = var.deploymentname
}
tags = var.tags
}

resource "azurerm_virtual_network_peering" "t2-to-hub" {
Expand Down Expand Up @@ -454,10 +421,7 @@ module "jumpbox-subnet" {
log_analytics_workspace_id = azurerm_log_analytics_workspace.laws.workspace_id
log_analytics_workspace_location = var.mlz_location
log_analytics_workspace_resource_id = azurerm_log_analytics_workspace.laws.id

tags = {
DeploymentName = var.deploymentname
}
tags = var.tags
}

module "bastion-host" {
Expand All @@ -473,10 +437,7 @@ module "bastion-host" {
subnet_address_prefix = var.bastion_address_space
public_ip_name = var.bastion_public_ip_name
ipconfig_name = var.bastion_ipconfig_name

tags = {
DeploymentName = var.deploymentname
}
tags = var.tags
}

module "jumpbox" {
Expand Down Expand Up @@ -508,10 +469,7 @@ module "jumpbox" {
linux_offer = var.jumpbox_linux_vm_offer
linux_sku = var.jumpbox_linux_vm_sku
linux_image_version = var.jumpbox_linux_vm_version

tags = {
DeploymentName = var.deploymentname
}
tags = var.tags
}

#####################################
Expand Down
13 changes: 7 additions & 6 deletions src/terraform/mlz/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ variable "tf_environment" {
default = "public"
}

variable "deploymentname" {
description = "A name for the deployment. It defaults to dev."
type = string
default = "dev"
}

variable "mlz_tenantid" {
description = "The Azure Active Directory tenant ID that should be used for the deployment."
type = string
Expand Down Expand Up @@ -59,6 +53,13 @@ variable "create_assignment" {
default = false
}

variable "tags" {
description = "A map of key value pairs to apply as tags to resources provisioned in this deployment"
type = map(string)
default = {
"DeploymentType" : "MissionLandingZoneTF"
}
}
#################################
# Hub Configuration
#################################
Expand Down
10 changes: 2 additions & 8 deletions src/terraform/tier3/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,7 @@ resource "azurerm_resource_group" "tier3" {

location = var.mlz_location
name = var.tier3_rgname

tags = {
DeploymentName = var.deploymentname
}
tags = var.tags
}

################################
Expand Down Expand Up @@ -139,10 +136,7 @@ module "spoke-network-t3" {
spoke_vnetname = var.tier3_vnetname
spoke_vnet_address_space = var.tier3_vnet_address_space
subnets = var.tier3_subnets

tags = {
DeploymentName = var.deploymentname
}
tags = var.tags
}

resource "azurerm_virtual_network_peering" "t3-to-hub" {
Expand Down
14 changes: 7 additions & 7 deletions src/terraform/tier3/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@ variable "tf_environment" {
default = "public"
}

variable "deploymentname" {
description = "A name for the deployment. It defaults to dev."
type = string
default = "dev"
}

variable "mlz_tenantid" {
description = "The Azure Active Directory tenant ID that should be used for the deployment."
type = string
Expand Down Expand Up @@ -51,7 +45,13 @@ variable "mlz_objectid" {
type = string
sensitive = true
}

variable "tags" {
description = "A map of key value pairs to apply as tags to resources provisioned in this deployment"
type = map(string)
default = {
"DeploymentType" : "MissionLandingZoneTF"
}
}
#################################
# Hub Configuration
#################################
Expand Down

0 comments on commit 5052d0f

Please sign in to comment.