Skip to content

azurermManagementGroupSubscriptionAssociation

Manages a Management Group Subscription Association.

!> Note: When using this resource, configuring subscriptionIds on the azurermManagementGroup resource is not supported.

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 dataAzurermManagementGroupExample =
  new azurerm.dataAzurermManagementGroup.DataAzurermManagementGroup(
    this,
    "example",
    {
      name: "exampleManagementGroup",
    }
  );
const dataAzurermSubscriptionExample =
  new azurerm.dataAzurermSubscription.DataAzurermSubscription(
    this,
    "example_1",
    {
      subscription_id: "12345678-1234-1234-1234-123456789012",
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
dataAzurermSubscriptionExample.overrideLogicalId("example");
const azurermManagementGroupSubscriptionAssociationExample =
  new azurerm.managementGroupSubscriptionAssociation.ManagementGroupSubscriptionAssociation(
    this,
    "example_2",
    {
      management_group_id: dataAzurermManagementGroupExample.id,
      subscription_id: dataAzurermSubscriptionExample.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"
);

Arguments Reference

The following arguments are supported:

  • managementGroupId - (Required) The ID of the Management Group to associate the Subscription with. Changing this forces a new Management to be created.

  • subscriptionId - (Required) The ID of the Subscription to be associated with the Management Group. Changing this forces a new Management to be created.

Attributes Reference

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

  • id - The ID of the Management Group Subscription Association.

Timeouts

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

  • create - (Defaults to 5 minutes) Used when creating the Management.
  • read - (Defaults to 5 minutes) Used when retrieving the Management.
  • delete - (Defaults to 5 minutes) Used when deleting the Management.

Import

Managements can be imported using the resourceId, e.g.

terraform import azurerm_management_group_subscription_association.example /managementGroup/MyManagementGroup/subscription/12345678-1234-1234-1234-123456789012