azurermBlueprintAssignment
Manages a Blueprint Assignment resource
\~> NOTE: Azure Blueprints are in Preview and potentially subject to breaking change without notice.
\~> NOTE: Azure Blueprint Assignments can only be applied to Subscriptions. Assignments to Management Groups is not currently supported by the service or by Terraform.
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.*/
new azurerm.provider.AzurermProvider(this, "azurerm", {
features: [{}],
});
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
this,
"example",
{
location: "West Europe",
name: "exampleRG-bp",
tags: {
Environment: "example",
},
}
);
const azurermUserAssignedIdentityExample =
new azurerm.userAssignedIdentity.UserAssignedIdentity(this, "example_2", {
location: azurermResourceGroupExample.location,
name: "bp-user-example",
resource_group_name: azurermResourceGroupExample.name,
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermUserAssignedIdentityExample.overrideLogicalId("example");
const dataAzurermClientConfigCurrent =
new azurerm.dataAzurermClientConfig.DataAzurermClientConfig(
this,
"current",
{}
);
const dataAzurermSubscriptionExample =
new azurerm.dataAzurermSubscription.DataAzurermSubscription(
this,
"example_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.*/
dataAzurermSubscriptionExample.overrideLogicalId("example");
const azurermRoleAssignmentOperator = new azurerm.roleAssignment.RoleAssignment(
this,
"operator",
{
principal_id: azurermUserAssignedIdentityExample.principalId,
role_definition_name: "Blueprint Operator",
scope: dataAzurermSubscriptionExample.id,
}
);
const azurermRoleAssignmentOwner = new azurerm.roleAssignment.RoleAssignment(
this,
"owner",
{
principal_id: azurermUserAssignedIdentityExample.principalId,
role_definition_name: "Owner",
scope: dataAzurermSubscriptionExample.id,
}
);
const dataAzurermBlueprintDefinitionExample =
new azurerm.dataAzurermBlueprintDefinition.DataAzurermBlueprintDefinition(
this,
"example_7",
{
name: "exampleBlueprint",
scope_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.*/
dataAzurermBlueprintDefinitionExample.overrideLogicalId("example");
const dataAzurermBlueprintPublishedVersionExample =
new azurerm.dataAzurermBlueprintPublishedVersion.DataAzurermBlueprintPublishedVersion(
this,
"example_8",
{
blueprint_name: dataAzurermBlueprintDefinitionExample.name,
scope_id: dataAzurermBlueprintDefinitionExample.scopeId,
version: "v1.0.0",
}
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
dataAzurermBlueprintPublishedVersionExample.overrideLogicalId("example");
const azurermBlueprintAssignmentExample =
new azurerm.blueprintAssignment.BlueprintAssignment(this, "example_9", {
depends_on: [
`\${${azurermRoleAssignmentOperator.fqn}}`,
`\${${azurermRoleAssignmentOwner.fqn}}`,
],
identity: [
{
identity_ids: [azurermUserAssignedIdentityExample.id],
type: "UserAssigned",
},
],
location: azurermResourceGroupExample.location,
lock_exclude_principals: [dataAzurermClientConfigCurrent.objectId],
lock_mode: "AllResourcesDoNotDelete",
name: "testAccBPAssignment",
parameter_values:
' {\n "allowedlocationsforresourcegroups_listOfAllowedLocations": {\n "value": ["westus", "westus2", "eastus", "centralus", "centraluseuap", "southcentralus", "northcentralus", "westcentralus", "eastus2", "eastus2euap", "brazilsouth", "brazilus", "northeurope", "westeurope", "eastasia", "southeastasia", "japanwest", "japaneast", "koreacentral", "koreasouth", "indiasouth", "indiawest", "indiacentral", "australiaeast", "australiasoutheast", "canadacentral", "canadaeast", "uknorth", "uksouth2", "uksouth", "ukwest", "francecentral", "francesouth", "australiacentral", "australiacentral2", "uaecentral", "uaenorth", "southafricanorth", "southafricawest", "switzerlandnorth", "switzerlandwest", "germanynorth", "germanywestcentral", "norwayeast", "norwaywest"]\n }\n }\n',
resource_groups:
' {\n "ResourceGroup": {\n "name": "exampleRG-bp"\n }\n }\n',
target_subscription_id: dataAzurermSubscriptionExample.id,
version_id: dataAzurermBlueprintPublishedVersionExample.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.*/
azurermBlueprintAssignmentExample.overrideLogicalId("example");
Argument Reference
-
name
- (Required) The name of the Blueprint Assignment. Changing this forces a new resource to be created. -
targetSubscriptionId
- (Required) The Subscription ID the Blueprint Published Version is to be applied to. Changing this forces a new resource to be created. -
location
- (Required) The Azure location of the Assignment. Changing this forces a new resource to be created. -
identity
- (Required) Anidentity
block as defined below. -
versionId
- (Required) The ID of the Published Version of the blueprint to be assigned. -
parameterValues
- (Optional) a JSON string to supply Blueprint Assignment parameter values.
\~> NOTE: Improperly formatted JSON, or missing values required by a Blueprint will cause the assignment to fail.
resourceGroups
- (Optional) a JSON string to supply the Blueprint Resource Group information.
\~> NOTE: Improperly formatted JSON, or missing values required by a Blueprint will cause the assignment to fail.
-
lockMode
- (Optional) The locking mode of the Blueprint Assignment. One ofnone
(Default),allResourcesReadOnly
, orallResourcesDoNotDelete
. Defaults tonone
. -
lockExcludePrincipals
- (Optional) a list of up to 5 Principal IDs that are permitted to bypass the locks applied by the Blueprint. -
lockExcludeActions
- (Optional) a list of up to 200 actions that are permitted to bypass the locks applied by the Blueprint.
An identity
block supports the following:
-
type
- (Required) Specifies the type of Managed Service Identity that should be configured on this Blueprint. Only possible value isuserAssigned
. -
identityIds
- (Required) Specifies a list of User Assigned Managed Identity IDs to be assigned to this Blueprint.
Attributes Reference
-
id
- The ID of the Blueprint Assignment -
description
- The Description on the Blueprint -
displayName
- The display name of the blueprint -
blueprintName
- The name of the blueprint assigned
Timeouts
The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 30 minutes) Used when creating the Blueprint Assignment.update
- (Defaults to 30 minutes) Used when updating the Blueprint Assignment.read
- (Defaults to 5 minutes) Used when retrieving the Blueprint Assignment.delete
- (Defaults to 5 minutes) Used when deleting the Blueprint Assignment.
Import
Azure Blueprint Assignments can be imported using the resourceId
, e.g.