Skip to content

azurermApiConnection

Manages an API Connection.

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 azurermServicebusNamespaceExample =
  new azurerm.servicebusNamespace.ServicebusNamespace(this, "example_2", {
    location: azurermResourceGroupExample.location,
    name: "acctestsbn-conn-example",
    resource_group_name: azurermResourceGroupExample.name,
    sku: "Basic",
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermServicebusNamespaceExample.overrideLogicalId("example");
const dataAzurermManagedApiExample =
  new azurerm.dataAzurermManagedApi.DataAzurermManagedApi(this, "example_3", {
    location: azurermResourceGroupExample.location,
    name: "servicebus",
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
dataAzurermManagedApiExample.overrideLogicalId("example");
const azurermApiConnectionExample = new azurerm.apiConnection.ApiConnection(
  this,
  "example_4",
  {
    display_name: "Example 1",
    managed_api_id: dataAzurermManagedApiExample.id,
    name: "example-connection",
    parameter_values: [
      {
        connectionString:
          azurermServicebusNamespaceExample.defaultPrimaryConnectionString,
      },
    ],
    resource_group_name: azurermResourceGroupExample.name,
    tags: {
      Hello: "World",
    },
  }
);
azurermApiConnectionExample.addOverride("lifecycle", [
  {
    ignore_changes: ["parameter_values"],
  },
]);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermApiConnectionExample.overrideLogicalId("example");

Arguments Reference

The following arguments are supported:

  • managedApiId - (Required) The ID of the Managed API which this API Connection is linked to. Changing this forces a new API Connection to be created.

  • name - (Required) The Name which should be used for this API Connection. Changing this forces a new API Connection to be created.

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


  • displayName - (Optional) A display name for this API Connection. Changing this forces a new API Connection to be created.

  • parameterValues - (Optional) A map of parameter values associated with this API Connection. Changing this forces a new API Connection to be created.

-> Note: The Azure API doesn't return sensitive parameters in the API response which can lead to a diff, as such you may need to use Terraform's ignoreChanges functionality on this field as shown in the Example Usage above.

  • tags - (Optional) A mapping of tags which should be assigned to the API Connection.

Attributes Reference

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

  • id - The ID of the API Connection.

Timeouts

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

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

Import

API Connections can be imported using the resourceId, e.g.

terraform import azurerm_api_connection.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/example/providers/Microsoft.Web/connections/example-connection