Skip to content

azurermManagedApplication

Manages a Managed Application.

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: "example-resources",
  }
);
const dataAzurermClientConfigCurrent =
  new azurerm.dataAzurermClientConfig.DataAzurermClientConfig(
    this,
    "current",
    {}
  );
const dataAzurermRoleDefinitionBuiltin =
  new azurerm.dataAzurermRoleDefinition.DataAzurermRoleDefinition(
    this,
    "builtin",
    {
      name: "Contributor",
    }
  );
const azurermManagedApplicationDefinitionExample =
  new azurerm.managedApplicationDefinition.ManagedApplicationDefinition(
    this,
    "example_4",
    {
      authorization: [
        {
          role_definition_id: `\${split("/", ${dataAzurermRoleDefinitionBuiltin.id})[length(split("/", ${dataAzurermRoleDefinitionBuiltin.id})) - 1]}`,
          service_principal_id: dataAzurermClientConfigCurrent.objectId,
        },
      ],
      description: "Test Managed App Definition",
      display_name: "TestManagedAppDefinition",
      location: azurermResourceGroupExample.location,
      lock_level: "ReadOnly",
      name: "examplemanagedapplicationdefinition",
      package_file_uri:
        "https://github.com/Azure/azure-managedapp-samples/raw/master/Managed Application Sample Packages/201-managed-storage-account/managedstorage.zip",
      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.*/
azurermManagedApplicationDefinitionExample.overrideLogicalId("example");
const azurermManagedApplicationExample =
  new azurerm.managedApplication.ManagedApplication(this, "example_5", {
    application_definition_id: azurermManagedApplicationDefinitionExample.id,
    kind: "ServiceCatalog",
    location: azurermResourceGroupExample.location,
    managed_resource_group_name: "infrastructureGroup",
    name: "example-managedapplication",
    parameters: [
      {
        location: azurermResourceGroupExample.location,
        storageAccountNamePrefix: "storeNamePrefix",
        storageAccountType: "Standard_LRS",
      },
    ],
    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.*/
azurermManagedApplicationExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

  • name - (Required) Specifies the name of the Managed Application. Changing this forces a new resource to be created.

  • resourceGroupName - (Required) The name of the Resource Group where the Managed Application should exist. Changing this forces a new resource to be created.

  • location - (Required) Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.

  • kind - (Required) The kind of the managed application to deploy. Possible values are marketPlace and serviceCatalog. Changing this forces a new resource to be created.

  • managedResourceGroupName - (Required) The name of the target resource group where all the resources deployed by the managed application will reside. Changing this forces a new resource to be created.

  • applicationDefinitionId - (Optional) The application definition ID to deploy.

  • parameters - (Optional) A mapping of name and value pairs to pass to the managed application as parameters.

  • parameterValues - (Optional) The parameter values to pass to the Managed Application. This field is a JSON object that allows you to assign parameters to this Managed Application.

  • plan - (Optional) One plan block as defined below.

  • tags - (Optional) A mapping of tags to assign to the resource.


The plan block exports the following:

  • name - (Required) Specifies the name of the plan from the marketplace.

  • product - (Required) Specifies the product of the plan from the marketplace.

  • publisher - (Required) Specifies the publisher of the plan.

  • version - (Required) Specifies the version of the plan from the marketplace.

  • promotionCode - (Optional) Specifies the promotion code to use with the plan.

\~> NOTE: When plan is specified, legal terms must be accepted for this item on this subscription before creating the Managed Application. The azurermMarketplaceAgreement resource or AZ CLI tool can be used to do this.

Attributes Reference

The following attributes are exported:

  • id - The ID of the Managed Application.

  • outputs - The name and value pairs that define the managed application outputs.

Timeouts

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

  • create - (Defaults to 30 minutes) Used when creating the Managed Application.
  • update - (Defaults to 30 minutes) Used when updating the Managed Application.
  • read - (Defaults to 5 minutes) Used when retrieving the Managed Application.
  • delete - (Defaults to 30 minutes) Used when deleting the Managed Application.

Import

Managed Application can be imported using the resourceId, e.g.

terraform import azurerm_managed_application.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Solutions/applications/app1