Skip to content

azurermNetworkManagerManagementGroupConnection

Manages a Network Manager Management Group Connection which may cross tenants.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
For a more precise conversion please use the --provider flag in convert.*/
const azurermManagementGroupExample =
  new azurerm.managementGroup.ManagementGroup(this, "example", {});
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
  this,
  "example_1",
  {
    location: "West Europe",
    name: "example-resources",
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermResourceGroupExample.overrideLogicalId("example");
const dataAzurermClientConfigCurrent =
  new azurerm.dataAzurermClientConfig.DataAzurermClientConfig(
    this,
    "current",
    {}
  );
const dataAzurermSubscriptionAlt =
  new azurerm.dataAzurermSubscription.DataAzurermSubscription(this, "alt", {
    subscription_id: "00000000-0000-0000-0000-000000000000",
  });
const dataAzurermSubscriptionCurrent =
  new azurerm.dataAzurermSubscription.DataAzurermSubscription(
    this,
    "current_4",
    {}
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
dataAzurermSubscriptionCurrent.overrideLogicalId("current");
const azurermManagementGroupSubscriptionAssociationExample =
  new azurerm.managementGroupSubscriptionAssociation.ManagementGroupSubscriptionAssociation(
    this,
    "example_5",
    {
      management_group_id: azurermManagementGroupExample.id,
      subscription_id: dataAzurermSubscriptionAlt.id,
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermManagementGroupSubscriptionAssociationExample.overrideLogicalId(
  "example"
);
const azurermNetworkManagerExample = new azurerm.networkManager.NetworkManager(
  this,
  "example_6",
  {
    location: azurermResourceGroupExample.location,
    name: "example-networkmanager",
    resource_group_name: azurermResourceGroupExample.name,
    scope: [
      {
        subscription_ids: [dataAzurermSubscriptionCurrent.id],
      },
    ],
    scope_accesses: ["SecurityAdmin"],
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermNetworkManagerExample.overrideLogicalId("example");
const azurermRoleAssignmentNetworkContributor =
  new azurerm.roleAssignment.RoleAssignment(this, "network_contributor", {
    principal_id: dataAzurermClientConfigCurrent.objectId,
    role_definition_name: "Network Contributor",
    scope: azurermManagementGroupExample.id,
  });
const azurermNetworkManagerManagementGroupConnectionExample =
  new azurerm.networkManagerManagementGroupConnection.NetworkManagerManagementGroupConnection(
    this,
    "example_8",
    {
      depends_on: [`\${${azurermRoleAssignmentNetworkContributor.fqn}}`],
      description: "example",
      management_group_id: azurermManagementGroupExample.id,
      name: "example-nmmgc",
      network_manager_id: azurermNetworkManagerExample.id,
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermNetworkManagerManagementGroupConnectionExample.overrideLogicalId(
  "example"
);

Arguments Reference

The following arguments are supported:

  • name - (Required) Specifies the name which should be used for this Network Manager Management Group Connection. Changing this forces a new Network Manager Management Group Connection to be created.

  • managementGroupId - (Required) Specifies the ID of the target Management Group. Changing this forces a new resource to be created.

  • networkManagerId - (Required) Specifies the ID of the Network Manager which the Management Group is connected to. Changing this forces a new resource to be created.

  • description - (Optional) A description of the Network Manager Management Group Connection.

Attributes Reference

In addition to the Arguments listed above - the following Attributes are exported:

  • id - The ID of the Network Manager Management Group Connection.

  • connectionState - The Connection state of the Network Manager Management Group Connection.

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

  • create - (Defaults to 30 minutes) Used when creating the Network Manager Management Group Connection.
  • read - (Defaults to 5 minutes) Used when retrieving the Network Manager Management Group Connection.
  • update - (Defaults to 30 minutes) Used when updating the Network Manager Management Group Connection.
  • delete - (Defaults to 30 minutes) Used when deleting the Network Manager Management Group Connection.

Import

Network Manager Management Group Connection can be imported using the resourceId, e.g.

terraform import azurerm_network_manager_management_group_connection.example /providers/Microsoft.Management/managementGroups/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/networkManagerConnections/networkManagerConnection1