-1

Is it possible to create an "azure managed application definition" using createUIDefintion.json file and terraform scripts, instead of a mainTemplate.json (arm template) ?.

old_timer
  • 69,149
  • 8
  • 89
  • 168
odin 147
  • 1
  • 1

1 Answers1

0

It is not possible because to create and publish a managed application definition you would need a zip file which should contain the mainTemplate.json and createUiDefinition.json files.

If you check this Create and publish a managed application definition document then you will find -

Every managed application definition includes a file named mainTemplate.json. In it, you define the Azure resources to deploy. The template is no different than a regular ARM template.

and

You define the portal experience for creating the managed application. The createUiDefinition.json file generates the portal interface. You define how users provide input for each parameter.

Then we package the files by adding the two files to a .zip file. And the two files must be at the root level of the .zip file. If you put them in a folder, you receive an error when creating the managed application definition.

After setting authorization rules, now you can create the managed application definition using terraform as shown below.

provider "azurerm" {
  features {}
}

data "azurerm_client_config" "current" {}

resource "azurerm_resource_group" "example" {
  name     = "example-resources"
  location = "West Europe"
}

resource "azurerm_managed_application_definition" "example" {
  name                = "example-managedapplicationdefinition"
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name
  lock_level          = "ReadOnly"
  package_file_uri    = "Path of the zip file...."
  display_name        = "TestManagedApplicationDefinition"
  description         = "Test Managed Application Definition"

  authorization {
    service_principal_id = data.azurerm_client_config.current.object_id
    role_definition_id   = "a094b430-dad3-424d-ae58-13f72fd72591"
  }
}

For more information read these Create and publish a managed application definition and azurerm_managed_application_definition document from terraform.

SauravDas-MT
  • 1,224
  • 1
  • 4
  • 10