Skip to content

azurermSpringCloudAppCosmosdbAssociation

Associates a Spring Cloud Application with a CosmosDB Account.

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 azurermSpringCloudServiceExample =
  new azurerm.springCloudService.SpringCloudService(this, "example_1", {
    location: azurermResourceGroupExample.location,
    name: "example-springcloud",
    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.*/
azurermSpringCloudServiceExample.overrideLogicalId("example");
const azurermCosmosdbAccountExample =
  new azurerm.cosmosdbAccount.CosmosdbAccount(this, "example_2", {
    consistency_policy: [
      {
        consistency_level: "Strong",
      },
    ],
    geo_location: [
      {
        failover_priority: 0,
        location: azurermResourceGroupExample.location,
      },
    ],
    kind: "GlobalDocumentDB",
    location: azurermResourceGroupExample.location,
    name: "example-cosmosdb-account",
    offer_type: "Standard",
    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.*/
azurermCosmosdbAccountExample.overrideLogicalId("example");
const azurermSpringCloudAppExample = new azurerm.springCloudApp.SpringCloudApp(
  this,
  "example_3",
  {
    name: "example-springcloudapp",
    resource_group_name: azurermResourceGroupExample.name,
    service_name: azurermSpringCloudServiceExample.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.*/
azurermSpringCloudAppExample.overrideLogicalId("example");
const azurermSpringCloudAppCosmosdbAssociationExample =
  new azurerm.springCloudAppCosmosdbAssociation.SpringCloudAppCosmosdbAssociation(
    this,
    "example_4",
    {
      api_type: "table",
      cosmosdb_access_key: azurermCosmosdbAccountExample.primaryKey,
      cosmosdb_account_id: azurermCosmosdbAccountExample.id,
      name: "example-bind",
      spring_cloud_app_id: azurermSpringCloudAppExample.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.*/
azurermSpringCloudAppCosmosdbAssociationExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

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

  • springCloudAppId - (Required) Specifies the ID of the Spring Cloud Application where this Association is created. Changing this forces a new resource to be created.

  • cosmosdbAccountId - (Required) Specifies the ID of the CosmosDB Account. Changing this forces a new resource to be created.

  • apiType - (Required) Specifies the API type which should be used when connecting to the CosmosDB Account. Possible values are cassandra, gremlin, mongo, sql or table. Changing this forces a new resource to be created.

  • cosmosdbAccessKey - (Required) Specifies the CosmosDB Account access key.

  • cosmosdbCassandraKeyspaceName - (Optional) Specifies the name of the Cassandra Keyspace which the Spring Cloud App should be associated with. Should only be set when apiType is cassandra.

  • cosmosdbGremlinDatabaseName - (Optional) Specifies the name of the Gremlin Database which the Spring Cloud App should be associated with. Should only be set when apiType is gremlin.

  • cosmosdbGremlinGraphName - (Optional) Specifies the name of the Gremlin Graph which the Spring Cloud App should be associated with. Should only be set when apiType is gremlin.

  • cosmosdbMongoDatabaseName - (Optional) Specifies the name of the Mongo Database which the Spring Cloud App should be associated with. Should only be set when apiType is mongo.

  • cosmosdbSqlDatabaseName - (Optional) Specifies the name of the SQL Database which the Spring Cloud App should be associated with. Should only be set when apiType is sql.

Attributes Reference

The following attributes are exported:

  • id - The ID of the Spring Cloud Application CosmosDB Association.

Timeouts

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

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

Import

Spring Cloud Application CosmosDB Association can be imported using the resourceId, e.g.

terraform import azurerm_spring_cloud_app_cosmosdb_association.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourcegroup1/providers/Microsoft.AppPlatform/spring/service1/apps/app1/bindings/bind1