azurermSpringCloudAppMysqlAssociation
Associates a Spring Cloud Application with a MySQL Database.
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 azurermMysqlServerExample = new azurerm.mysqlServer.MysqlServer(
this,
"example_2",
{
administrator_login: "mysqladminun",
administrator_login_password: "H@Sh1CoR3!",
location: azurermResourceGroupExample.location,
name: "example-mysqlserver",
resource_group_name: azurermResourceGroupExample.name,
sku_name: "B_Gen5_2",
ssl_enforcement_enabled: true,
ssl_minimal_tls_version_enforced: "TLS1_2",
storage_mb: 5120,
version: "5.7",
}
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermMysqlServerExample.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 azurermMysqlDatabaseExample = new azurerm.mysqlDatabase.MysqlDatabase(
this,
"example_4",
{
charset: "utf8",
collation: "utf8_unicode_ci",
name: "exampledb",
resource_group_name: azurermResourceGroupExample.name,
server_name: azurermMysqlServerExample.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.*/
azurermMysqlDatabaseExample.overrideLogicalId("example");
const azurermSpringCloudAppMysqlAssociationExample =
new azurerm.springCloudAppMysqlAssociation.SpringCloudAppMysqlAssociation(
this,
"example_5",
{
database_name: azurermMysqlDatabaseExample.name,
mysql_server_id: azurermMysqlServerExample.id,
name: "example-bind",
password: azurermMysqlServerExample.administratorLoginPassword,
spring_cloud_app_id: azurermSpringCloudAppExample.id,
username: azurermMysqlServerExample.administratorLogin,
}
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermSpringCloudAppMysqlAssociationExample.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. -
mysqlServerId
- (Required) Specifies the ID of the MySQL Server. Changing this forces a new resource to be created. -
databaseName
- (Required) Specifies the name of the MySQL Database which the Spring Cloud App should be associated with. -
username
- (Required) Specifies the username which should be used when connecting to the MySQL Database from the Spring Cloud App. -
password
- (Required) Specifies the password which should be used when connecting to the MySQL Database from the Spring Cloud App.
Attributes Reference
The following attributes are exported:
id
- The ID of the Spring Cloud Application MySQL 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 MySQL Association.read
- (Defaults to 5 minutes) Used when retrieving the Spring Cloud Application MySQL Association.update
- (Defaults to 30 minutes) Used when updating the Spring Cloud Application MySQL Association.delete
- (Defaults to 30 minutes) Used when deleting the Spring Cloud Application MySQL Association.
Import
Spring Cloud Application MySQL Association can be imported using the resourceId
, e.g.