Skip to content

azurermContainerAppEnvironmentDaprComponent

Manages a Dapr Component for a Container App Environment.

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 azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
  this,
  "example",
  {
    location: "West Europe",
    name: "example-resources",
  }
);
const azurermLogAnalyticsWorkspaceExample =
  new azurerm.logAnalyticsWorkspace.LogAnalyticsWorkspace(this, "example_1", {
    location: azurermResourceGroupExample.location,
    name: "acctest-01",
    resource_group_name: azurermResourceGroupExample.name,
    retention_in_days: 30,
    sku: "PerGB2018",
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermLogAnalyticsWorkspaceExample.overrideLogicalId("example");
const azurermContainerAppEnvironmentExample =
  new azurerm.containerAppEnvironment.ContainerAppEnvironment(
    this,
    "example_2",
    {
      location: azurermResourceGroupExample.location,
      log_analytics_workspace_id: azurermLogAnalyticsWorkspaceExample.id,
      name: "Example-Environment",
      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.*/
azurermContainerAppEnvironmentExample.overrideLogicalId("example");
const azurermContainerAppEnvironmentDaprComponentExample =
  new azurerm.containerAppEnvironmentDaprComponent.ContainerAppEnvironmentDaprComponent(
    this,
    "example_3",
    {
      component_type: "state.azure.blobstorage",
      container_app_environment_id: azurermContainerAppEnvironmentExample.id,
      name: "example-component",
      version: "v1",
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermContainerAppEnvironmentDaprComponentExample.overrideLogicalId("example");

Arguments Reference

The following arguments are supported:

  • containerAppEnvironmentId - (Required) The ID of the Container App Managed Environment for this Dapr Component. Changing this forces a new resource to be created.

  • name - (Required) The name for this Dapr component. Changing this forces a new resource to be created.

  • type - (Required) The Dapr Component Type. For example stateAzureBlobstorage. Changing this forces a new resource to be created.

  • version - (Required) The version of the component.


  • ignoreErrors - (Optional) Should the Dapr sidecar to continue initialisation if the component fails to load. Defaults to false

  • initTimeout - The timeout for component initialisation as a iso8601 formatted string. e.g. 5S, 2H, 1M. Defaults to 5S

  • metadata - (Optional) One or more metadata blocks as detailed below.

  • scopes - (Optional) A list of scopes to which this component applies.

\~> NOTE: See the official docs for more information at https://learn.microsoft.com/en-us/azure/container-apps/dapr-overview?tabs=bicep1%2Cyaml#component-scopes

  • secret - (Optional) A secret block as detailed below.

A metadata block supports the following:

  • name - (Required) The name of the Metadata configuration item.

  • secretName - (Optional) The name of a secret specified in the secrets block that contains the value for this metadata configuration item.

  • value - (Optional) The value for this metadata configuration item.


A secret block supports the following:

  • name - (Required) The Secret name.

  • value - (Required) The value for this secret.

Attributes Reference

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

  • id - The ID of the Container App Environment Dapr Component

Timeouts

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

  • create - (Defaults to 30 minutes) Used when creating the Container App Environment Dapr Component.
  • update - (Defaults to 30 minutes) Used when updating the Container App Environment Dapr Component.
  • read - (Defaults to 5 minutes) Used when retrieving the Container App Environment Dapr Component.
  • delete - (Defaults to 30 minutes) Used when deleting the Container App Environment Dapr Component.

Import

A Dapr Component for a Container App Environment can be imported using the resourceId, e.g.

terraform import azurerm_container_app_environment_dapr_component.example "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resGroup1/providers/Microsoft.App/managedEnvironments/myenv/daprComponents/mydaprcomponent"