Giter Club home page Giter Club logo

terraform-azurerm-lz-vending's Introduction

Terraform landing zone vending module for Azure

Average time to resolve an issue Percentage of issues still open

Overview

The landing zone Terraform module is designed to accelerate deployment of individual landing zones within an Azure tenant. We use the AzureRM and AzAPI providers to create the subscription and deploy the resources in a single terrafom apply step.

The module is designed to be instantiated many times, once for each desired landing zone.

This is currently split logically into the following capabilities:

  • Subscription creation and management group placement
  • Networking - deploy multiple vnets with:
    • Hub & spoke connectivity (peering to a hub network)
    • vWAN connectivity
    • Mesh peering (peering between spokes)
  • Role assignments
  • Resource provider (and feature) registration
  • Resource group creation
  • User assigned managed identity creation
    • Federated credential configuration for GitHub Actions, Terraform Cloud, and other providers.

When creating virtual network peerings, be aware of the limit of peerings per virtual network.

We would like feedback on what's missing in the module. Please raise an issue if you have any suggestions.

Change log

Please see the GitHub releases pages for change log information.

Notes

Please see the content in the wiki for more detailed information.

Example

The below example created a landing zone subscription with two virtual networks. One virtual network is in the default location of the subscription, the other is in a different location.

The virtual networks are peered with the supplied hub network resource ids, they are also peered with each other using the mesh peering option.

module "lz_vending" {
  source  = "Azure/lz-vending/azurerm"
  version = "<version>" # change this to your desired version, https://www.terraform.io/language/expressions/version-constraints

  # Set the default location for resources
  location = "westeurope"

  # subscription variables
  subscription_alias_enabled = true
  subscription_billing_scope = "/providers/Microsoft.Billing/billingAccounts/1234567/enrollmentAccounts/123456"
  subscription_display_name  = "my-subscription-display-name"
  subscription_alias_name    = "my-subscription-alias"
  subscription_workload      = "Production"

  network_watcher_resource_group_enabled = true

  # management group association variables
  subscription_management_group_association_enabled = true
  subscription_management_group_id                  = "Corp"

  # virtual network variables
  virtual_network_enabled = true
  virtual_networks = {
    one = {
      name                    = "my-vnet"
      address_space           = ["192.168.1.0/24"]
      hub_peering_enabled     = true
      hub_network_resource_id = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-hub-network-rg/providers/Microsoft.Network/virtualNetworks/my-hub-network"
      mesh_peering_enabled    = true
    }
    two = {
      name                    = "my-vnet2"
      location                = "northeurope"
      address_space           = ["192.168.2.0/24"]
      hub_peering_enabled     = true
      hub_network_resource_id = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-hub-network-rg/providers/Microsoft.Network/virtualNetworks/my-hub-network2"
      mesh_peering_enabled    = true
    }
  }

  umi_enabled             = true
  umi_name                = "umi"
  umi_resource_group_name = "rg-identity"
  umi_role_assignments = {
    myrg-contrib = {
      definition     = "Contributor"
      relative_scope = "/resourceGroups/MyRg"
    }
  }

  resource_group_creation_enabled = true
  resource_groups = {
    myrg = {
      name     = "MyRg"
      location = "westeurope"
    }
  }

  # role assignments
  role_assignment_enabled = true
  role_assignments = {
    # using role definition name, created at subscription scope
    contrib_user_sub = {
      principal_id   = "00000000-0000-0000-0000-000000000000"
      definition     = "Contributor"
      relative_scope = ""
    },
    # using a custom role definition
    custdef_sub_scope = {
      principal_id   = "11111111-1111-1111-1111-111111111111"
      definition     = "/providers/Microsoft.Management/MyMg/providers/Microsoft.Authorization/roleDefinitions/ffffffff-ffff-ffff-ffff-ffffffffffff"
      relative_scope = ""
    },
    # using relative scope (to the created or supplied subscription)
    rg_owner = {
      principal_id   = "00000000-0000-0000-0000-000000000000"
      definition     = "Owner"
      relative_scope = "/resourceGroups/MyRg"
    },
  }
}

Documentation

Requirements

The following requirements are needed by this module:

Modules

The following Modules are called:

Source: ./modules/budget

Version:

Source: ./modules/resourcegroup

Version:

Source: ./modules/resourcegroup

Version:

Source: ./modules/resourceprovider

Version:

Source: ./modules/roleassignment

Version:

Source: ./modules/roleassignment

Version:

Source: ./modules/subscription

Version:

Source: ./modules/usermanagedidentity

Version:

Source: ./modules/virtualnetwork

Version:

Required Inputs

The following input variables are required:

Description: The default location of resources created by this module.
Virtual networks will be created in this location unless overridden by the location attribute.

Type: string

Optional Inputs

The following input variables are optional (have default values):

Description: Whether to create budgets.
If enabled, supply the list of budgets in var.budgets.

Type: bool

Default: false

Description: Map of budgets to create for the subscription.

  • amount - The total amount of cost to track with the budget.
  • time_grain - The time grain for the budget. Must be one of Annually, BillingAnnual, BillingMonth, BillingQuarter, Monthly, or Quarterly.
  • time_period_start - The start date for the budget.
  • time_period_end - The end date for the budget.
  • relative_scope - (optional) Scope relative to the created subscription. Omit, or leave blank for subscription scope.
  • notifications - (optional) The notifications to create for the budget.
    • enabled - Whether the notification is enabled.
    • operator - The operator for the notification. Must be one of GreaterThan or GreaterThanOrEqualTo.
    • threshold - The threshold for the notification. Must be between 0 and 1000.
    • threshold_type - The threshold type for the notification. Must be one of Actual or Forecasted.
    • contact_emails - The contact emails for the notification.
    • contact_roles - The contact roles for the notification.
    • contact_groups - The contact groups for the notification.
    • locale - The locale for the notification. Must be in the format xx-xx.

time_period_start and time_period_end must be UTC in RFC3339 format, e.g. 2018-05-13T07:44:12Z.

Example value:

subscription_budgets = {
  budget1 = {
    amount            = 150
    time_grain        = "Monthly"
    time_period_start = "2024-01-01T00:00:00Z"
    time_period_end   = "2027-12-31T23:59:59Z"
    notifications = {
      eightypercent = {
        enabled        = true
        operator       = "GreaterThan"
        threshold      = 80
        threshold_type = "Actual"
        contact_emails = ["[email protected]"]
      }
      budgetexceeded = {
        enabled        = true
        operator       = "GreaterThan"
        threshold      = 120
        threshold_type = "Forecasted"
        contact_groups = ["Owner"]
      }
    }
  }
}

Type:

map(object({
    amount            = number
    time_grain        = string
    time_period_start = string
    time_period_end   = string
    relative_scope    = optional(string, "")
    notifications = optional(map(object({
      enabled        = bool
      operator       = string
      threshold      = number
      threshold_type = optional(string, "Actual")
      contact_emails = optional(list(string), [])
      contact_roles  = optional(list(string), [])
      contact_groups = optional(list(string), [])
      locale         = optional(string, "en-us")
    })), {})
  }))

Default: {}

Description: To disable tracking, we have included this variable with a simple boolean flag.
The default value is false which does not disable the telemetry.
If you would like to disable this tracking, then simply set this value to true and this module will not create the telemetry tracking resources and therefore telemetry tracking will be disabled.

For more information, see the wiki

E.g.

module "lz_vending" {
  source  = "Azure/lz-vending/azurerm"
  version = "<version>" # change this to your desired version, https://www.terraform.io/language/expressions/version-constraints

  # ... other module variables

  disable_telemetry = true
}

Type: bool

Default: false

Description: Create NetworkWatcherRG in the subscription.

Although this resource group is created automatically by Azure,
it is not managed by Terraform and therefore can impede the subscription cancellation process.

Enabling this variable will create the resource group in the subscription and allow Terraform to manage it,
which includes destroying the resource (and all resources within it).

Type: bool

Default: false

Description: Whether to create additional resource groups in the target subscription. Requires var.resource_groups.

Type: bool

Default: false

Description: A map of the resource groups to create. The value is an object with the following attributes:

  • name - the name of the resource group
  • location - the location of the resource group
  • tags - (optional) a map of type string

Do not include the NetworkWatcherRG resource group in this map if you have enabled var.network_watcher_resource_group_enabled.

Type:

map(object({
    name     = string
    location = string
    tags     = optional(map(string), {})
  }))

Default: {}

Description: Whether to create role assignments.
If enabled, supply the list of role assignments in var.role_assignments.

Type: bool

Default: false

Description: Supply a map of objects containing the details of the role assignments to create.

Object fields:

  • principal_id: The directory/object id of the principal to assign the role to.
  • definition: The role definition to assign. Either use the name or the role definition resource id.
  • relative_scope: (optional) Scope relative to the created subscription. Omit, or leave blank for subscription scope.
  • condition: (optional) A condition to apply to the role assignment. See Conditions Custom Security Attributes for more details.
  • condition_version: (optional) The version of the condition syntax. See Conditions Custom Security Attributes for more details.

E.g.

role_assignments = {
  # Example using role definition name:
  contributor_user = {
    principal_id      = "00000000-0000-0000-0000-000000000000",
    definition        = "Contributor",
    relative_scope    = "",
    condition         = "(!(ActionMatches{'Microsoft.Storage/storageAccounts/blobServices/containers/blobs/read'} AND NOT SubOperationMatches{'Blob.List'})",
    condition_version = "2.0",
  },
  # Example using role definition id and RG scope:
  myrg_custom_role = {
    principal_id   = "11111111-1111-1111-1111-111111111111",
    definition     = "/providers/Microsoft.Management/managementGroups/mymg/providers/Microsoft.Authorization/roleDefinitions/aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa",
    relative_scope = "/resourceGroups/MyRg",
  }
}

Type:

map(object({
    principal_id      = string,
    definition        = string,
    relative_scope    = optional(string, ""),
    condition         = optional(string, ""),
    condition_version = optional(string, ""),
  }))

Default: {}

Description: Whether to create a new subscription using the subscription alias resource.

If enabled, the following must also be supplied:

  • subscription_alias_name
  • subscription_display_name
  • subscription_billing_scope
  • subscription_workload

Optionally, supply the following to enable the placement of the subscription into a management group:

  • subscription_management_group_id
  • subscription_management_group_association_enabled

If disabled, supply the subscription_id variable to use an existing subscription instead.

Note: When the subscription is destroyed, this module will try to remove the NetworkWatcherRG resource group using az cli. This requires the az cli tool be installed and authenticated. If the command fails for any reason, the provider will attempt to cancel the subscription anyway.

Type: bool

Default: false

Description: The name of the subscription alias.

The string must be comprised of a-z, A-Z, 0-9, - and _.
The maximum length is 63 characters.

You may also supply an empty string if you do not want to create a new subscription alias.
In this scenario, subscription_enabled should be set to false and subscription_id must be supplied.

Type: string

Default: ""

Description: The billing scope for the new subscription alias.

A valid billing scope starts with /providers/Microsoft.Billing/billingAccounts/ and is case sensitive.

E.g.

  • For CustomerLed and FieldLed, e.g. MCA - /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}
  • For PartnerLed, e.g. MPA - /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}
  • For Legacy EA - /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts/{enrollmentAccountName}

You may also supply an empty string if you do not want to create a new subscription alias.
In this scenario, subscription_enabled should be set to false and subscription_id must be supplied.

Type: string

Default: ""

Description: The display name of the subscription alias.

The string must be comprised of a-z, A-Z, 0-9, -, _ and space.
The maximum length is 63 characters.

You may also supply an empty string if you do not want to create a new subscription alias.
In this scenario, subscription_enabled should be set to false and subscription_id must be supplied.

Type: string

Default: ""

Description: An existing subscription id.

Use this when you do not want the module to create a new subscription.
But do want to manage the management group membership.

A GUID should be supplied in the format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.
All letters must be lowercase.

When using this, subscription_management_group_association_enabled should be enabled,
and subscription_management_group_id should be supplied.

You may also supply an empty string if you want to create a new subscription alias.
In this scenario, subscription_alias_enabled should be set to true and the following other variables must be supplied:

  • subscription_alias_name
  • subscription_alias_display_name
  • subscription_alias_billing_scope
  • subscription_alias_workload

Type: string

Default: ""

Description: Whether to create the azurerm_management_group_subscription_association resource.

If enabled, the subscription_management_group_id must also be supplied.

Type: bool

Default: false

Description: The destination management group ID for the new subscription.

Note: Do not supply the display name.
The management group ID forms part of the Azure resource ID. E.g., /providers/Microsoft.Management/managementGroups/{managementGroupId}.

Type: string

Default: ""

Description: The map of resource providers to register.
The map keys are the resource provider namespace, e.g. Microsoft.Compute.
The map values are a list of provider features to enable.
Leave the value empty to not register any resource provider features.

The default values are taken from Hashicorp's AzureRM provider.

Type: map(set(string))

Default:

{
  "Microsoft.AVS": [],
  "Microsoft.ApiManagement": [],
  "Microsoft.AppPlatform": [],
  "Microsoft.Authorization": [],
  "Microsoft.Automation": [],
  "Microsoft.Blueprint": [],
  "Microsoft.BotService": [],
  "Microsoft.Cache": [],
  "Microsoft.Cdn": [],
  "Microsoft.CognitiveServices": [],
  "Microsoft.Compute": [],
  "Microsoft.ContainerInstance": [],
  "Microsoft.ContainerRegistry": [],
  "Microsoft.ContainerService": [],
  "Microsoft.CostManagement": [],
  "Microsoft.CustomProviders": [],
  "Microsoft.DBforMariaDB": [],
  "Microsoft.DBforMySQL": [],
  "Microsoft.DBforPostgreSQL": [],
  "Microsoft.DataLakeAnalytics": [],
  "Microsoft.DataLakeStore": [],
  "Microsoft.DataMigration": [],
  "Microsoft.DataProtection": [],
  "Microsoft.Databricks": [],
  "Microsoft.DesktopVirtualization": [],
  "Microsoft.DevTestLab": [],
  "Microsoft.Devices": [],
  "Microsoft.DocumentDB": [],
  "Microsoft.EventGrid": [],
  "Microsoft.EventHub": [],
  "Microsoft.GuestConfiguration": [],
  "Microsoft.HDInsight": [],
  "Microsoft.HealthcareApis": [],
  "Microsoft.KeyVault": [],
  "Microsoft.Kusto": [],
  "Microsoft.Logic": [],
  "Microsoft.MachineLearningServices": [],
  "Microsoft.Maintenance": [],
  "Microsoft.ManagedIdentity": [],
  "Microsoft.ManagedServices": [],
  "Microsoft.Management": [],
  "Microsoft.Maps": [],
  "Microsoft.MarketplaceOrdering": [],
  "Microsoft.Media": [],
  "Microsoft.MixedReality": [],
  "Microsoft.Network": [],
  "Microsoft.NotificationHubs": [],
  "Microsoft.OperationalInsights": [],
  "Microsoft.OperationsManagement": [],
  "Microsoft.PolicyInsights": [],
  "Microsoft.PowerBIDedicated": [],
  "Microsoft.RecoveryServices": [],
  "Microsoft.Relay": [],
  "Microsoft.Resources": [],
  "Microsoft.Search": [],
  "Microsoft.Security": [],
  "Microsoft.SecurityInsights": [],
  "Microsoft.ServiceBus": [],
  "Microsoft.ServiceFabric": [],
  "Microsoft.Sql": [],
  "Microsoft.Storage": [],
  "Microsoft.StreamAnalytics": [],
  "Microsoft.TimeSeriesInsights": [],
  "Microsoft.Web": [],
  "microsoft.insights": []
}

Description: Whether to register resource providers for the subscription.
Use var.subscription_register_resource_providers_and_features to customize registration.

Type: bool

Default: false

Description: A map of tags to assign to the newly created subscription.
Only valid when subsciption_alias_enabled is set to true.

Example value:

subscription_tags = {
  mytag  = "myvalue"
  mytag2 = "myvalue2"
}

Type: map(string)

Default: {}

Description: Whether to update an existing subscription with the supplied tags and display name.
If enabled, the following must also be supplied:

  • subscription_id

Type: bool

Default: false

Description: Whether to create a new subscription using the azapi provider. This may be required if the principal running
terraform does not have the required permissions to create a subscription under the default management group.
If enabled, the following must also be supplied:

  • subscription_alias_name
  • subscription_display_name
  • subscription_billing_scope
  • subscription_workload
    Optionally, supply the following to enable the placement of the subscription into a management group:
  • subscription_management_group_id
  • subscription_management_group_association_enabled
    If disabled, supply the subscription_id variable to use an existing subscription instead.

Note: When the subscription is destroyed, this module will try to remove the NetworkWatcherRG resource group using az cli. This requires the az cli tool be installed and authenticated. If the command fails for any reason, the provider will attempt to cancel the subscription anyway.

Type: bool

Default: false

Description: The billing scope for the new subscription alias.

The workload type can be either Production or DevTest and is case sensitive.

You may also supply an empty string if you do not want to create a new subscription alias.
In this scenario, subscription_enabled should be set to false and subscription_id must be supplied.

Type: string

Default: ""

Description: Whether to enable the creation of a user-assigned managed identity.

Requires umi_name and umi_resosurce_group_name to be non-empty.

Type: bool

Default: false

Description: Configure federated identity credentials, using OpenID Connect, for use scenarios outside GitHub Actions and Terraform Cloud.

The may key is arbitrary and only used for the for_each in the resource declaration.

The map value is an object with the following attributes:

  • name: The name of the federated credential resource, the last segment of the Azure resource id.
  • subject_identifier: The subject of the token.
  • issuer_url: The URL of the token issuer, should begin with https://
  • audience: (optional) The token audience, defaults to api://AzureADTokenExchange.

Type:

map(object({
    name               = string
    subject_identifier = string
    issuer_url         = string
    audiences          = optional(set(string), ["api://AzureADTokenExchange"])
  }))

Default: {}

Description: Configure federated identity credentials, using OpenID Connect, for use in GitHub actions.

The may key is arbitrary and only used for the for_each in the resource declaration.

The map value is an object with the following attributes:

  • name - the name of the federated credential resource, the last segment of the Azure resource id.
  • organization - the name of the GitHub organization, e.g. Azure in https://github.com/Azure/terraform-azurerm-lz-vending.
  • repository - the name of the GitHub respository, e.g. terraform-azurerm-lz-vending in https://github.com/Azure/terraform-azurerm-lz-vending.
  • entity - one of 'environment', 'pull_request', 'tag', or 'branch'
  • value - identifies the entity type, e.g. main when using entity is branch. Should be blank when entity is pull_request.

Type:

map(object({
    name         = optional(string, "")
    organization = string
    repository   = string
    entity       = string
    value        = optional(string, "")
  }))

Default: {}

Description: Configure federated identity credentials, using OpenID Connect, for use in Terraform Cloud.

The may key is arbitrary and only used for the for_each in the resource declaration.

The map value is an object with the following attributes:

  • name - the name of the federated credential resource, the last segment of the Azure resource id.
  • organization - the name of the Terraform Cloud organization.
  • project - the name of the Terraform Cloud project.
  • workspace - the name of the Terraform Cloud workspace.
  • run_phase - one of plan, or apply.

Type:

map(object({
    name         = optional(string, "")
    organization = string
    project      = string
    workspace    = string
    run_phase    = string
  }))

Default: {}

Description: The name of the user-assigned managed identity

Type: string

Default: ""

Description: Whether to create the supplied resource group for the user-assigned managed identity

Type: bool

Default: true

Description: Whether to enable resource group lock for the user-assigned managed identity resource group

Type: bool

Default: true

Description: The name of the resource group lock for the user-assigned managed identity resource group, if blank will be set to lock-<resource_group_name>

Type: string

Default: ""

Description: The name of the resource group in which to create the user-assigned managed identity

Type: string

Default: ""

Description: The tags to apply to the user-assigned managed identity resource group, if we create it.

Type: map(string)

Default: {}

Description: Supply a map of objects containing the details of the role assignments to create for the user-assigned managed identity.
This will be merged with the other role assignments specified in var.role_assignments.

The role assignments can be used resource groups created by the var.resource_groups map.

Requires both var.umi_enabled and var.role_assignment_enabled to be true.

Object fields:

  • definition: The role definition to assign. Either use the name or the role definition resource id.
  • relative_scope: Scope relative to the created subscription. Leave blank for subscription scope.

Type:

map(object({
    definition        = string
    relative_scope    = optional(string, "")
    condition         = optional(string, "")
    condition_version = optional(string, "")
  }))

Default: {}

Description: The tags to apply to the user-assigned managed identity

Type: map(string)

Default: {}

Description: Enables and disables the virtual network submodule.

Type: bool

Default: false

Description: A map of the virtual networks to create. The map key must be known at the plan stage, e.g. must not be calculated and known only after apply.

Required fields

  • name: The name of the virtual network. [required]
  • address_space: The address space of the virtual network as a list of strings in CIDR format, e.g. ["192.168.0.0/24", "10.0.0.0/24"]. [required]
  • resource_group_name: The name of the resource group to create the virtual network in. [required]

DNS servers

  • dns_servers: A list of DNS servers to use for the virtual network, e.g. ["192.168.0.1", "10.0.0.1"]. If empty will use the Azure default DNS. [optional - default empty list]

DDOS protection plan

  • ddos_protection_enabled: Whether to enable ddos protection. [optional]
  • ddos_protection_plan_id: The resource ID of the protection plan to attach the vnet. [optional - but required if ddos_protection_enabled is true]

Location

  • location: The location of the virtual network (and resource group if creation is enabled). [optional, will use var.location if not specified or empty string]

Note at least one of location or var.location must be specified. If both are empty then the module will fail.

Hub network peering values

The following values configure bi-directional hub & spoke peering for the given virtual network.

  • hub_peering_enabled: Whether to enable hub peering. [optional]
  • hub_peering_direction: The direction of the peering. [optional - allowed values are: tohub, fromhub or both - default both]
  • hub_network_resource_id: The resource ID of the hub network to peer with. [optional - but required if hub_peering_enabled is true]
  • hub_peering_name_tohub: The name of the peering to the hub network. [optional - leave empty to use calculated name]
  • hub_peering_name_fromhub: The name of the peering from the hub network. [optional - leave empty to use calculated name]
  • hub_peering_use_remote_gateways: Whether to use remote gateways for the hub peering. [optional - default true]

Mesh peering values

Mesh peering is the capability to create a bi-directional peerings between all supplied virtual networks in var.virtual_networks.
Peerings will only be created between virtual networks with the mesh_peering_enabled value set to true.

  • mesh_peering_enabled: Whether to enable mesh peering for this virtual network. Must be enabled on more than one virtual network for any peerings to be created. [optional]
  • mesh_peering_allow_forwarded_traffic: Whether to allow forwarded traffic for the mesh peering. [optional - default false]

Resource group values

The default is that a resource group will be created for each resource_group_name specified in the var.virtual_networks map.
It is possible to use a pre-existing resource group by setting resource_group_creation_enabled to false.
We recommend using resource groups aligned to the region of the virtual network,
however if you want multiple virtual networks in more than one location to share a resource group,
only one of the virtual networks should have resource_group_creation_enabled set to true.

  • resource_group_creation_enabled: Whether to create a resource group for the virtual network. [optional - default true]
  • resource_group_lock_enabled: Whether to create a CanNotDelete resource lock on the resource group. [optional - default true]
  • resource_group_lock_name: The name of the resource lock. [optional - leave empty to use calculated name]
  • resource_group_tags: A map of tags to apply to the resource group, e.g. { mytag = "myvalue", mytag2 = "myvalue2" }. [optional - default empty]

Virtual WAN values

  • vwan_associated_routetable_resource_id: The resource ID of the route table to associate with the virtual network. [optional - leave empty to use defaultRouteTable on hub]
  • vwan_connection_enabled: Whether to create a connection to a Virtual WAN. [optional - default false]
  • vwan_connection_name: The name of the connection to the Virtual WAN. [optional - leave empty to use calculated name]
  • vwan_hub_resource_id: The resource ID of the hub to connect to. [optional - but required if vwan_connection_enabled is true]
  • vwan_propagated_routetables_labels: A list of labels of route tables to propagate to the virtual network. [optional - leave empty to use ["default"]]
  • vwan_propagated_routetables_resource_ids: A list of resource IDs of route tables to propagate to the virtual network. [optional - leave empty to use defaultRouteTable on hub]
  • vwan_security_configuration: A map of security configuration values for VWAN hub connection - see below. [optional - default empty]
    • secure_internet_traffic: Whether to forward internet-bound traffic to the destination specified in the routing policy. [optional - default false]
    • secure_private_traffic: Whether to all internal traffic to the destination specified in the routing policy. Not compatible with routing_intent_enabled. [optional - default false]
    • routing_intent_enabled: Enable to use with a Virtual WAN hub with routing intent enabled. Routing intent on hub is configured outside this module. [optional - default false]

Tags

  • tags: A map of tags to apply to the virtual network. [optional - default empty]

Type:

map(object({
    name                = string
    address_space       = list(string)
    resource_group_name = string

    location = optional(string, "")

    dns_servers = optional(list(string), [])

    ddos_protection_enabled = optional(bool, false)
    ddos_protection_plan_id = optional(string, "")

    hub_network_resource_id         = optional(string, "")
    hub_peering_enabled             = optional(bool, false)
    hub_peering_direction           = optional(string, "both")
    hub_peering_name_tohub          = optional(string, "")
    hub_peering_name_fromhub        = optional(string, "")
    hub_peering_use_remote_gateways = optional(bool, true)

    mesh_peering_enabled                 = optional(bool, false)
    mesh_peering_allow_forwarded_traffic = optional(bool, false)

    resource_group_creation_enabled = optional(bool, true)
    resource_group_lock_enabled     = optional(bool, true)
    resource_group_lock_name        = optional(string, "")
    resource_group_tags             = optional(map(string), {})

    vwan_associated_routetable_resource_id   = optional(string, "")
    vwan_connection_enabled                  = optional(bool, false)
    vwan_connection_name                     = optional(string, "")
    vwan_hub_resource_id                     = optional(string, "")
    vwan_propagated_routetables_labels       = optional(list(string), [])
    vwan_propagated_routetables_resource_ids = optional(list(string), [])
    vwan_security_configuration = optional(object({
      secure_internet_traffic = optional(bool, false)
      secure_private_traffic  = optional(bool, false)
      routing_intent_enabled  = optional(bool, false)
    }), {})

    tags = optional(map(string), {})
  }))

Default: {}

Description: The duration to wait after vending a subscription before performing subscription operations.

Type:

object({
    create  = optional(string, "30s")
    destroy = optional(string, "0s")
  })

Default: {}

Resources

The following resources are used by this module:

Outputs

The following outputs are exported:

Description: The management_group_subscription_association_id output is the ID of the management group subscription association.
Value will be null if var.subscription_management_group_association_enabled is false.

Description: The subscription_id is the Azure subscription id that resources have been deployed into.

Description: The subscription_resource_id is the Azure subscription resource id that resources have been deployed into

Description: The client id of the user managed identity.
Value will be null if var.umi_enabled is false.

Description: The Azure resource id of the user managed identity.
Value will be null if var.umi_enabled is false.

Description: The principal id of the user managed identity, sometimes known as the object id.
Value will be null if var.umi_enabled is false.

Description: The tenant id of the user managed identity.
Value will be null if var.umi_enabled is false.

Description: A map of resource group ids, keyed by the var.virtual_networks input map. Only populated if the virtualnetwork submodule is enabled.

Description: A map of virtual network resource ids, keyed by the var.virtual_networks input map. Only populated if the virtualnetwork submodule is enabled.

Telemetry

When you deploy one or more modules using the landing zone vending module, Microsoft can identify the installation of said module with the deployed Azure resources. Microsoft can correlate these resources used to support the software. Microsoft collects this information to provide the best experiences with their products and to operate their business. The telemetry is collected through customer usage attribution. The data is collected and governed by Microsoft's privacy policies.

If you don't wish to send usage data to Microsoft, details on how to turn it off can be found here.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Developing the Module

See DEVELOPER.md.

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.

terraform-azurerm-lz-vending's People

Contributors

b0bu avatar celdus avatar dependabot[bot] avatar hfrenzel avatar jaredfholgate avatar kashifsaadat avatar krottiers avatar luke-taylor avatar matt-ffffff avatar microsoft-github-operations[bot] avatar microsoft-github-policy-service[bot] avatar microsoftopensource avatar mysteq avatar nyanhp avatar ppodevlabs avatar tcharewicz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

terraform-azurerm-lz-vending's Issues

Support for resource tags

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Add support for resource tags for the:

  1. Landing zone subscription
  2. Landing zone resource group
  3. Landing zone virtual network

Describe the solution you'd like

Additional context

Feature Request - Ability to re-establish lz-vending hub peering in cases where hub(s) has been redeployed

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Is your feature request related to an issue? Not really an issue but implementing this feature request would allow to reduce costs in dev/test environment and also improve reliability/stability of production environment where ESLZ hub is redeployed.

I am using ALZ in my lab and to keep cost down, I am redeploying ESLZ on a regular basis (week-end or even daily).
After implementing lz-vending, I initially followed standard workflow (aka tf destroyed my workloads, tf destroyed lz-vending deployment and updated eslz with hubs disabled. As it takes significant time, I tried to see what happened if I only redeployed ESLZ with hubs disabled without touching workload and lz-vending.

In my test, adding back the ESLZ hubs went smoothly. Vending subnet peering status moved as Disconnected as expected.
In order to reconnect the vending vnets with hub, I re-applied my tz-vending deployment and 2 issues:

  1. Error triggered because there is no azurerm_management_group_subscription_association
    โ”‚ Error: could not read properties for Management Group "dev-landing-zones" with module.lz_vending["landing_zone_1.yaml"].module.subscription[0].azurerm_management_group_subscription_association.this[0], on .terraform\modules\lz_vending\modules\subscription\main.tf line 20, in resource azurerm_management_group_subscription_association" "this":
    โ”‚ 20: resource "azurerm_management_group_subscription_association" "this" {

I am not sure why but removing ESLZ hub seemed to have moved back vending subscriptions under my "New Subscriptions" MG. Moving back manually one of the subscriptions ensured there was at least one "azurerm_management_group_subscription_association" and redeplyment of all lz-vending sub under the proper MG went smoothly but then 2nd error popped-up:

  1. Error when trying to re-establish peer with newly created hub
    โ”‚ Error: creating/updating "Resource: (ResourceId "/subscriptions/e4f86ded-632e-46f0-9d88-56cf56ee72c0/resourceGroups/dev-connectivity-northeurope/providers/Microsoft.Network/virtualNetworks/dev-hub-northeurope/virtualNetworkPeerings/peer-629dbe4b-43c7-5b24-942f-18233610489c" / Api Version "2021-08-01")": PUT https://management.azure.com/subscriptions/e4f86ded-632e-46f0-9d88-56cf56ee72c0/resourceGroups/dev-connectivity-northeurope/providers/Microsoft.Network/virtualNetworks/dev-hub-northeurope/virtualNetworkPeerings/peer-629dbe4b-43c7-5b24-942f-18233610489c
    โ”‚ --------------------------------------------------------------------------------
    โ”‚ RESPONSE 400: 400 Bad Request
    โ”‚ ERROR CODE: RemotePeeringIsDisconnected
    โ”‚ --------------------------------------------------------------------------------
    โ”‚ {
    โ”‚ "error": {
    โ”‚ "code": "RemotePeeringIsDisconnected",
    โ”‚ "message": "Cannot create or update peering /subscriptions/e4f86ded-632e-46f0-9d88-56cf56ee72c0/resourceGroups/dev-connectivity-northeurope/providers/Microsoft.Network/virtualNetworks/dev-hub-northeurope/virtualNetworkPeerings/peer-629dbe4b-43c7-5b24-942f-18233610489c because remote peering /subscriptions/0f11ed9d-9abc-480a-8ab0-4220af1c954b/resourceGroups/rg-vnets/providers/Microsoft.Network/virtualNetworks/vnet-dev-lz02-01/virtualNetworkPeerings/peer-a95edc20-3b69-5411-bf23-518807b277d6 referencing parent virtual network /subscriptions/e4f86ded-632e-46f0-9d88-56cf56ee72c0/resourceGroups/dev-connectivity-northeurope/providers/Microsoft.Network/virtualNetworks/dev-hub-northeurope is in Disconnected state. Update or re-create the remote peering to get it back to Initiated state. Peering gets Disconnected when remote vnet or remote peering is deleted and re-created.",
    โ”‚ "details": []
    โ”‚ }
    โ”‚ }

I did not manage to find a quick workaround for this one. If there is an easy fix then I believe there is feature request could help reduce costs/time of our dev workflow and also potentially add some level of reliability by enabling lz-vending to work in case of hub redeployment.

Describe the solution you'd like

Ability to re-establish peering with newly created hub.

Additional context

bug: Error creating Subscription w/ Role Assignment on a new Service Principal

Versions

Please paste the output of terraform version command from within the initialized directory:

Terraform v1.3.7

Please enter the module version that you are using:

v2.1.1

Description

I have a reusable module where I am creating a Service Principal and Subscription together. The RBAC ID of the Service Principal is passed in the role_assignments variable for the LZ vending module. When I attempt to run this, I get an error as follows:

on .terraform/modules/lz.app.subscription/main.roleassignment.tf line 10, in module "roleassignment":
โ”‚   10:   for_each                     = local.role_assignments_map
โ”‚     โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
โ”‚     โ”‚ local.role_assignments_map will be known only after apply

It seems this is caused because the local var is generated with a unique id based off the contents of each map, but that isn't known until the Service Principal has been created. A workaround would be to -target the SP creation first and then the Subscription, but as this is wrapped in a module and called many times it becomes a bit of a pain to manage.

Steps to Reproduce

  1. Create a Service Principal and Subscription, similar to below:
data "azuread_client_config" "current" {}

resource "azuread_application" "app" {
  display_name = "app"
  owners       = [data.azuread_client_config.current.object_id]
}

resource "azuread_service_principal" "sp" {
  application_id               = var.app_id
  app_role_assignment_required = true
  owners                       = [data.azuread_client_config.current.object_id]
}

module "lz_vending" {
  source = "Azure/lz-vending/azurerm"
  version = "v2.1.1"
  location = var.primary_location
  subscription_alias_enabled = true
  subscription_billing_scope = var.billing_scope
  subscription_display_name  = var.name
  subscription_alias_name    = var.name
  subscription_workload      = "Production"

  subscription_management_group_association_enabled = true
  subscription_management_group_id                  = var.mg_id
  subscription_tags                                 = var.tags
  virtual_network_enabled                           = false
  role_assignment_enabled                           = true
  role_assignments = [
    {
      principal_id   = azuread_service_principal.sp.rbac_id
      definition     = "Owner"
      relative_scope = ""
    }
  ]
}
  1. Run a terraform plan

Test bug report

Community Note

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Versions

terraform:

azure provider:

module:

Description

Describe the bug

Steps to Reproduce

  1. step 1
  2. step 2
  3. you get it...

Screenshots

Additional context

feat:Report on Subscription Creator role assignment in Azure Tenant

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Is your feature request related to an issue? No

I need to be able to report on where the subscription creator role(s) have been assigned to SPN(s) within my Azure tenant.

Describe the solution you'd like

When subscription creator is assigned to an SPN this is done via an API call rather than assigning a RBAC role in the Azure Portal. This makes it difficult to report on where subscription creator has been assigned. Business teams such as Security or InfoSec require a simple to run report that will detail which Azure EA Account has subscription creator assigned and to which SPN(s).

This report ought be in the Azure Portal alongside the newly ported EA functionality, making this will be consistent with the user experience that already exists.

Additional context

Test Bug Report

Community Note

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Versions

terraform:

azure provider:

module:

Description

Describe the bug

Steps to Reproduce

  1. step 1
  2. step 2
  3. you get it...

Screenshots

Additional context

bug: incorrect value type for virtual_networks object

Community Note

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Versions

module: 2.0.1

Description

Describe the bug

Incorrect value type for virtual_networks

hub_peering_enabled = optional(string, false)

Should be bool

Steps to Reproduce

  1. step 1
  2. step 2
  3. you get it...

Screenshots

Additional context

feat: policy assignments at subscription scope

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Add support for policy assignments at subscription scope.

Ref Azure/terraform-azurerm-caf-enterprise-scale#337

Describe the solution you'd like

Additional context

Feature Request

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Is your feature request related to an issue?

Describe the solution you'd like

Additional context

Feature Request using this for initial subscriptions for CAF enterprise deployments

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Is your feature request related to an issue?

Describe the solution you'd like

SO i am wondering if you can use this vending as a pre cursor in the CAF enterprise deployment to create the first 3 needed subscriptions by modifying the var values and using the outputs from their creation to fill in the providers.tf variables for the subscription IDs

Additional context

Feature Request - Ability to disable inbound peering

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Is your feature request related to an issue?

Describe the solution you'd like

I would like the inbound peering to be optional. I'm using the CAF Enterprise Scale module to setup the whole ES framework. (https://github.com/Azure/terraform-azurerm-lz-vending/blob/813c30f136e7b21979f0c15a1c1913c7e82f1acb/docs/wiki/Example-4-Integration-with-ALZ-module.md#locals)

I'm using the spoke_virtual_network_resource_ids property there to let the ES module make the initial peer towards the spoke. It will also setup the Private DNS zones. I would like to use the lz-vending module to make the second peer towards the hub. That currently doesn't work as I'm getting an ERROR CODE: AnotherPeeringAlreadyReferencesRemoteVnet error on:

โ”‚   on .terraform/modules/corp_lz/modules/virtualnetwork/main.tf line 104, in resource "azapi_resource" "peering_hub_inbound":
โ”‚  104: resource "azapi_resource" "peering_hub_inbound" {

This approach is also a best practice from a least privilege perspective, as I can now let one service principal handle the ES deployment and the other the landing zone deployments.

Thanks!

Additional context

CC: @krowlandson

Virtual network submodule deletes subnets created elsewhere

Community Note

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Describe the bug

Azure/azure-quickstart-templates#2786

Additional context

Attempting mitigation in azapi provider: Azure/terraform-provider-azapi#146

Ability to manage the membership of a management group for a subscription

Initially the module supports placing a subscription into a management group.

Over time it may become necessary to move this subscription to a different management group.

This could be performed by using the azurerm provider and creating a azurerm_management_group_subscription_association resource

feat: Creating and Managing NSG, UDR

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Is your feature request related to an issue?

Partially

We started using this today and deployed successfully. Few things to check before we go deep.
Creating and managing UDR and NSG, does that something offer here or do we need to take care of that ? Apologies if I have missed an obvious

Nice and easy way to create and manage NSG/UDR for spoke

Additional context

feat: aad group creation

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Sub-module to create n number of AAD groups and assign them to the subscription (or child scopes)

Describe the solution you'd like

Something like this...

module "lz-vending" {
  source  = "Azure/lz-vending/azurerm"
  version = "2.1.1"

  # other vars...
  aad_group_enabled = true
  aad_groups = {
    contrib_group = {
      name = "myContribGroup"
      role_assignments = [
        {
          definition     = "Contributor"
          relative_scope = ""
        }
      ]
    }
  }
}

Additional context

Add optional telemetry

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Add optional telemetry deployments for newly created subscriptions.

Describe the solution you'd like

Additional context

Feature Request: Support for resource group and vnet tags

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Is your feature request related to an issue?

We have a policy which enforces tags, at present this module doesn't support tags on resource groups or vnets.

Describe the solution you'd like

Add support for tags on resource groups and vnets.

We have a policy which enforces tags which means we have to delete the assignment / add an exception to allow resource group or vnets to be built.

Additional context

I did see that #62 added support to use tags with subscriptions.

Bug Report

Community Note

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Versions

terraform:

azure provider:

module:

Description

Describe the bug

Steps to Reproduce

  1. step 1
  2. step 2
  3. you get it...

Screenshots

Additional context

bug: linked subscription '00000000-0000-0000-0000-000000000000' was not found

Community Note

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Versions

Please paste the output of terraform version command from within the initialized directory:

<output of terraform version>

Please enter the module version that you are using:

<module version>

Description

Steps to Reproduce

  1. step 1
  2. step 2
  3. you get it...

Screenshots

Additional context

subscription_alias_enabled = true

โ•ท
โ”‚ Error: creating/updating "Resource: (ResourceId "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/xxxxxxxxxxxx/providers/Microsoft.Network/virtualNetworks/xxxxxxxxxxxx" / Api Version "2021-08-01")": PUT https://management.azure.com/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/xxxxxxxxxxxx/providers/Microsoft.Network/virtualNetworks/xxxxxxxxxxxx
โ”‚ --------------------------------------------------------------------------------
โ”‚ RESPONSE 403: 403 Forbidden
โ”‚ ERROR CODE: LinkedAuthorizationFailed
โ”‚ --------------------------------------------------------------------------------
โ”‚ {
โ”‚ "error": {
โ”‚ "code": "LinkedAuthorizationFailed",
โ”‚ "message": "The client has permission to perform action 'Microsoft.Network/ddosProtectionPlans/join/action' on scope '/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/xxxxxxxxxxxx/providers/Microsoft.Network/virtualNetworks/xxxxxxxxxxxx', however the linked subscription '00000000-0000-0000-0000-000000000000' was not found. "
โ”‚ }
โ”‚ }
โ”‚ --------------------------------------------------------------------------------
โ”‚
โ”‚
โ”‚ with module.lz_vending.module.virtualnetwork[0].azapi_resource.vnet["one"],
โ”‚ on .terraform/modules/lz_vending/modules/virtualnetwork/main.tf line 37, in resource "azapi_resource" "vnet":
โ”‚ 37: resource "azapi_resource" "vnet" {
โ”‚
โ•ต

feat: option to link vnet with ddos protection plan

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Provide option to link to existing ddos protection plan.

Describe the solution you'd like

Additional context

feat: Will this module support Microsoft Customer Agreement

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Is your feature request related to an issue?

This is more a question, but there was no template for that. Later this year (the 31st of May for my organization) many organizations will have to migrate from current Azure EA agreements to Microsoft Customer Agreement. In that regard, will this module continue working?

From the brief overview of the azapi provider I don't see any immediate problems. But the maintainers here might have a better understanding of how this all is configured together and would be able to confirm if this will be an issue or not?

Describe the solution you'd like

Would like to confirm that the module will work with Microsoft Customer Agreement.

Additional context

Role assignment deployment tests

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

  1. Add deployment tests for the role assignment sub-module
  2. Add role assignments into the integration deployment test

Describe the solution you'd like

Additional context

Naming incorrect for vhub connection

Community Note

Thanks @jtracey93

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Incorrect name for vhub connection, will conflict when more than one vnet is associated.

"vhubcon-${local.hub_network_uuidv5}"

Steps to Reproduce

  1. step 1
  2. step 2
  3. you get it...

Screenshots

Additional context

Clarify vhub connection name

Community Note

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

BREAKING CHANGE

@jtracey93 suggested renaming variable to avoid ambiguity.

virtual_network_vwan_routetable_resource_id to virtual_network_vwan_associated_routetable_resource_id

Describe the bug

Screenshots

Additional context

feat: updated documentation on usage with ALZ

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

The documentation on integration with the ALZ module describes the following when using the vending module:

# management group association variables
subscription_management_group_association_enabled = true
subscription_management_group_id                                 = "mymg"

However, the management_group_id called "mymg" isn't referenced in the ALZ block above. This might be confusing and lead to potential bugs / undocumented dependencies.

For example, if I create "mymg" with the custom_landing_zones property of ALZ and I destroy ALZ resources and then my want to update subscription resources, then I get the the error message:

"'/providers/Microsoft.Management/managementGroups/mymg' not found"

Describe the solution you'd like

  • Updated Example where "mymg" is created as a custom landing zone
  • Dependency graph between ALZ and the vending module

Additional context

feat: add internet security for vhub connections

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

https://learn.microsoft.com/en-us/azure/templates/microsoft.network/virtualhubs/hubvirtualnetworkconnections?pivots=deployment-language-bicep

Add enableInternetSecurity bool

AB#25716

Is your feature request related to an issue?

Describe the solution you'd like

Additional context

bug: Creation of AAD Groups and assignment of custom role

Community Note

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Versions

2.1.1

Please paste the output of terraform version command from within the initialized directory:

<output of terraform version>

Please enter the module version that you are using:

<module version>

Description

I would like to create AAD groups for a new subscription in the same run as creation of the new subscription, and assign appropriate roles to these groups on the newly created subscription. One of these roles is a custom role whose definition is on the intermediate root management group.
For this I create an additional groups.tf, in which the AAD groups are created and then the roles on the subscription are assigned.

//AAD Group creation
resource "azuread_group" "contributor_no_network" {
  display_name     = "AZ_RBAC_subscriptionContributorNoNetwork"
  security_enabled = true
}

//Management group association
resource "azurerm_management_group_subscription_association" "mg_association" {
  management_group_id = "/providers/Microsoft.Management/managementGroups/${var.management_group_id}"
  subscription_id     = module.lz-vending.subscription_resource_id
}

//Role assignment
resource "azurerm_role_assignment" "contributor_no_network" {
  depends_on = [ azurerm_management_group_subscription_association.mg_association]
  scope              = module.lz-vending.subscription_resource_id
  role_definition_id = var.roledefinition_customRole_SubscriptionContributorNoNetwork_id
  principal_id       = azuread_group.contributor_no_network[0].id
}

My problem is that the subscription is created by default under the tenant root management group, on which the custom role is not defined. I perform in the same code an association of the subscription under a management group that contains the definition.

However, Terraform still does not find the definition and returns the follwing error:

โ”‚ Error: authorization.RoleAssignmentsClient#Create: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="RoleAssignmentScopeNotAssignableToRoleDefinition" Message="The role [DEV] Subscription-Contributor-NoNetwork is not available for assignment at the requested scope."
โ”‚โ”‚   with azurerm_role_assignment.contributor_no_network[0],
โ”‚   on groups.tf line 49, in resource "azurerm_role_assignment" "contributor_no_network":โ”‚   49: resource "azurerm_role_assignment" "contributor_no_network" {
โ”‚

Only when I run the same code a second time, the assignment of the Custom Role works.

I tried

  • doing the management group association via the lz-vending module, but that does not work either. Doing it in the groups.tf gives me at least the opportunity to work with "depends_on".
  • adding a timer_delay of 60 seconds betweend management group association and role assignment.

Does creating AAD groups in the same run even match the idea of the lz-vending module? Or should I do this in a separate code? Thanks for any answers and suggestions!

Steps to Reproduce

  1. step 1
  2. step 2
  3. you get it...

Screenshots

Additional context

Implement provider version constraints for testing

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Describe the solution you'd like

Define supported provider versions and define test matrix.

Additional context

bug: vnet location not optional in parent module

Community Note

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Versions

terraform:

azure provider:

module:

Description

Describe the bug

Parent module:

Child module:

Add documentation for version upgrades

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Add wiki doc page explaining release strategy

Describe the solution you'd like

Additional context

feat: option to link vnets with private DNS zones

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Provide a list of private DNS zone resource IDs that we link to the vnets.

Provide a link to a private DNS resolver ruleset

Describe the solution you'd like

Additional context

feat: MSDFC pricing plan and subplan

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Some security center resource type like virtual machines or storage account can be customised with a subplan to adjust the pricing of that service.

As of today the following subplan are supported:

  • Storage accounts ("PerStorageAccount")
  • VirtualMachines ("P1" or "P2")

In the current implementation there is a boolean value to enable or disable the service.

 // Management resources
  deploy_management_resources = true
  configure_management_resources = {
    advanced = null
    location = ""
    settings = {
      log_analytics = {
        # removed for clarity
      }
      security_center = {
        config = {
          email_security_contact             = "[email protected]"
          enable_defender_for_app_services   = true
          enable_defender_for_arm            = true
          enable_defender_for_containers     = true
          enable_defender_for_dns            = true
          enable_defender_for_key_vault      = true
          enable_defender_for_oss_databases  = true
          enable_defender_for_servers        = true
          enable_defender_for_sql_server_vms = true
          enable_defender_for_sql_servers    = true
          enable_defender_for_storage        = true
        }
        enabled = true
      }
    }
    tags = null
  }

Describe the solution you'd like

Customise the pricing at the platform landingzone level
Customise the pricing at the landingzone or sub-level

Additional context

Feature Request: Add vnet_id as an output

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Is your feature request related to an issue?
No

We would like to use the vnet_id of any vnets that are generated from this vending module without having to use a data source.

Describe the solution you'd like

outputs.tf to include the vnet_id of any vnets it creates. At present it only outputs the subscription_id's. It looks like vnet_id is in the output.tf from the virtualnetwork submodule

Additional context

This will allow us to use this vending module to create a 'connectivity' subscription and then pass the vnet_id into any other subscriptions for vnet peering them back to the connectivity.

Destroy does not cancel subscription due to NetworkWatcherRG

Community Note

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Versions

terraform:

azure provider:

module:

Description

Describe the bug

Steps to Reproduce

  1. step 1
  2. step 2
  3. you get it...

Screenshots

Additional context

feat: add support for custom DNS servers on virtual networks

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Add DNS server support for created virtual networks

Describe the solution you'd like

Additional context

subscription_alias_enabled = false doesn't allow creation of subscription

Community Note

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Versions

terraform:

azure provider:

module:

Description

Describe the bug

When deciding not to use aliases using subscription_alias_enabled = false - new subscriptions are not created.

Steps to Reproduce

subscription_alias_enabled = false
Add relevant subscription details
terraform apply

Screenshots

Additional context

feat: module should return resource groups created by the module

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

When creating vnets for the spokes, the module output the ids of the vnets created but it does not expose the resource groups where those vnets were created.

This would be useful in cases like our where we need this resource groups to assign permissions to some service principals to handle those.

Describe the solution you'd like

make the module to output those resource groups. something like

output "resource_group_ids" {
  description = "The created resource_groups IDs, expressed as a map."
  value = {
    for k, v in azapi_resource. rg : k => v.id
  }
}

Additional context

Clarify value of `subscription_billing_scope`

Community Note

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Versions

terraform: 1.2.7

azure provider: 3.7

module: subscrtion

Description

Describe the bug

im trying to see if i am doing something wrong

i do not want to have the modules int he .terraform so i am using raw files

added a providers .tf with feature block as needed

added the variables that i could find int he variables.subscription.tf

wanted to make sure 1
the

/providers/Microsoft.Billing/billingAccounts/ ( IS THE SUBSCRITION ID)

and 2

after entering the required items from the comments i still get these errors?

i dont see where i am suppose to enter these.

โ•ท
โ”‚ Error: ID was missing the billingProfiles element
โ”‚
โ”‚ with module.subscription[0].azurerm_subscription.this[0],
โ”‚ on modules/subscription/main.tf line 6, in resource "azurerm_subscription" "this":
โ”‚ 6: billing_scope_id = var.subscription_billing_scope
โ”‚
โ•ต
โ•ท
โ”‚ Error: ID was missing the enrollmentAccounts element
โ”‚
โ”‚ with module.subscription[0].azurerm_subscription.this[0],
โ”‚ on modules/subscription/main.tf line 6, in resource "azurerm_subscription" "this":
โ”‚ 6: billing_scope_id = var.subscription_billing_scope
โ”‚
โ•ต
โ•ท
โ”‚ Error: ID was missing the customers element
โ”‚
โ”‚ with module.subscription[0].azurerm_subscription.this[0],
โ”‚ on modules/subscription/main.tf line 6, in resource "azurerm_subscription" "this":
โ”‚ 6: billing_scope_id = var.subscription_billing_scope
โ”‚

Steps to Reproduce

  1. step 1
  2. step 2
  3. you get it...

Screenshots

Additional context

Feature Request: Allow for more than one vnet per subscription

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Is your feature request related to an issue?

No open issue but we cannot use the module to build more than one vnet per subscription

Describe the solution you'd like

We would like the ability to add more than one vnet per subscription. The use case for this is when you have one subscription but using resources in multiple regions. For example:

Subscription: "AVD"
Vnet1: "vnet-avd-uksouth"
Vnet2: "vnet-avd-ukwest"

At present the yaml /module only supports one vnet (example)

display_name: avd
name: avd
workload: Production
location: uksouth
management_group_id: lz-avd
vnet_rg_name: rg-vnet-avd
vnet_name: vnet-avd-uksouth
vnet_address_space:
  - "10.0.3.0/24"
  - "192.168.3.0/24"

It looks like vnets could use a terraform map the same way that role assigments does.

As a workaround we will be trying to use the Example 5 Use with existing subscriptions to add more vnets or native terraform.

Additional context

Module is brilliant, keep up the good work :)

Add resource locks

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Add support for deploying a resource lock to the virtual network resource group.

Describe the solution you'd like

Additional context

test: Add integration deployment test for multiple LZs

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Need testing for multiple LZs to ensure that resource naming is unique.

Am i missing a variable thats not spelled out for Vnet creation

Community Note

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Versions

terraform:

azure provider:

module:

Description

Describe the bug

I run the program without creating a vnet no issue.

when i try to enable Vnet creation i get up to RG creation and get a link failure its looking for a 000 subscription

see below

azapi_resource.telemetry_root[0]: Creation complete after 13s [id=/subscriptions/25XXXXXa-c9ed-41b4-XXXX-6937afeef16d/providers/Microsoft.Resources/deployments/pid-50a8a460-d517-4b11-b86c-6de447806b67_0.3.0_00000d03]
โ•ท
โ”‚ Error: creating/updating "Resource: (ResourceId "/subscriptions/25XXXXXXa-c9ed-41b4-XXXX-6937afeef16d/resourceGroups/Demo-Epic-Prod-rgp/providers/Microsoft.Network/virtualNetworks/Demo_Epic_Prod_Vnet" / Api Version "2021-08-01")": PUT https://management.azure.com/subscriptions/253XXXXX-c9ed-41b4-XXXX-6937afeef16d/resourceGroups/Demo-Epic-Prod-rgp/providers/Microsoft.Network/virtualNetworks/Demo_Epic_Prod_Vnet
โ”‚ --------------------------------------------------------------------------------
โ”‚ RESPONSE 403: 403 Forbidden
โ”‚ ERROR CODE: LinkedAuthorizationFailed
โ”‚ --------------------------------------------------------------------------------
โ”‚ {
โ”‚ "error": {
โ”‚ "code": "LinkedAuthorizationFailed",
โ”‚ "message": "The client has permission to perform action 'Microsoft.Network/ddosProtectionPlans/join/action' on scope '/subscriptions/253XXXX-c9ed-41b4-XXXX-6937afeef16d/resourceGroups/Demo-Epic-Prod-rgp/providers/Microsoft.Network/virtualNetworks/Demo_Epic_Prod_Vnet', however the linked subscription '00000000-0000-0000-0000-000000000000' was not found. "
โ”‚ }
โ”‚ }
โ”‚ --------------------------------------------------------------------------------
โ”‚
โ”‚
โ”‚ with module.virtualnetwork[0].azapi_resource.vnet,
โ”‚ on modules/virtualnetwork/main.tf line 32, in resource "azapi_resource" "vnet":
โ”‚ 32: resource "azapi_resource" "vnet" {
โ”‚

I dont find DDos in any of the files other than an example and i dont have it turned on in my current deployment since i will not allow inbound this is all private

also does this not support subnet creation during vnet creation?

Steps to Reproduce

  1. step 1
  2. step 2
  3. you get it...

Screenshots

Additional context

feat: budget support

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Add capability to deploy budgets with subscriptions

Describe the solution you'd like

Additional context

Test

Community Note

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Versions

terraform:

azure provider:

module:

Description

Describe the bug

Steps to Reproduce

  1. step 1
  2. step 2
  3. you get it...

Screenshots

Additional context

test: scale testing

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Run a capacity test to demonstrate scaling.

Describe the solution you'd like

Additional context

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.