Skip to content

Latest commit

 

History

History
77 lines (56 loc) · 3.05 KB

File metadata and controls

77 lines (56 loc) · 3.05 KB

Introduction

Route Table module can deploy these resources:

  • azurerm_route_table (required)
  • azurerm_route (optional)

Example variables structure is located in variables.md.

Example use case is located in test-case/locals.tf.

You can also see changelog.

Terraform documentation:

https://registry.terraform.io/providers/hashicorp/azurerm/4.1.0/docs/resources/route_table

https://registry.terraform.io/providers/hashicorp/azurerm/4.1.0/docs/resources/route

 

WARNING: AzureRM provider had been updated to a new major version. Many breaking changes were implemented. See the providers guide for more information.

Terraform Import

There are a few things you need to do to import resources into .tfstate. In the example below there are resources which can be imported within the module. You may need to modify these commands to the OS on which they will be running (Refer to the documentation for additional details).

Route Table

  • terraform import '<path-to-module>.azurerm_route_table.route_table["<route-table-name>"]' '/subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/Microsoft.Network/routeTables/<route-table-name>'

Route

  • terraform import '<path-to-module>.azurerm_route.route["<route-table-name>_<route-name>"]' '/subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/Microsoft.Network/routeTables/<route-table-name>/routes/<route-name>'

NOTE: <path-to-module> is terraform logical path from root. e.g. module.route_table

 

Outputs

Structure

Output Name Value Comment
outputs name
id
routes Route outputs
 name
 id

Example usage of outputs

In the example below, outputted id of the deployed Route Table module is used as a value for the scope variable in Role Assignment resource.

module "rt" {
    source = "[email protected]:Seyfor-CSC/mit.route-table.git?ref=v1.0.0"
    config = [
        {
            name                = "SEY-TERRAFORM-NE-RT01"
            location            = "northeurope"
            resource_group_name = "SEY-TERRAFORM-NE-RG01"
        }
    ]
}

data "azurerm_client_config" "azurerm_client_config" {
}

resource "azurerm_role_assignment" "role_assignment" {
    scope                = module.rt.outputs.sey-terraform-ne-rt01.id # This is how to use output values
    role_definition_name = "Contributor"
    principal_id         = data.azurerm_client_config.azurerm_client_config.object_id
}

 

Module Features

No special features in module.

 

Known Issues

We currently log no issues in this module.