aiven.MysqlDatabase
Explore with Pulumi AI
The MySQL Database resource allows the creation and management of Aiven MySQL Databases.
Example Usage
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aiven = Pulumi.Aiven;
return await Deployment.RunAsync(() =>
{
var mydatabase = new Aiven.MysqlDatabase("mydatabase", new()
{
Project = aiven_project.Myproject.Project,
ServiceName = aiven_mysql.Mymysql.Service_name,
DatabaseName = "<DATABASE_NAME>",
});
});
package main
import (
"github.com/pulumi/pulumi-aiven/sdk/v6/go/aiven"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := aiven.NewMysqlDatabase(ctx, "mydatabase", &aiven.MysqlDatabaseArgs{
Project: pulumi.Any(aiven_project.Myproject.Project),
ServiceName: pulumi.Any(aiven_mysql.Mymysql.Service_name),
DatabaseName: pulumi.String("<DATABASE_NAME>"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aiven.MysqlDatabase;
import com.pulumi.aiven.MysqlDatabaseArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var mydatabase = new MysqlDatabase("mydatabase", MysqlDatabaseArgs.builder()
.project(aiven_project.myproject().project())
.serviceName(aiven_mysql.mymysql().service_name())
.databaseName("<DATABASE_NAME>")
.build());
}
}
import pulumi
import pulumi_aiven as aiven
mydatabase = aiven.MysqlDatabase("mydatabase",
project=aiven_project["myproject"]["project"],
service_name=aiven_mysql["mymysql"]["service_name"],
database_name="<DATABASE_NAME>")
import * as pulumi from "@pulumi/pulumi";
import * as aiven from "@pulumi/aiven";
const mydatabase = new aiven.MysqlDatabase("mydatabase", {
project: aiven_project.myproject.project,
serviceName: aiven_mysql.mymysql.service_name,
databaseName: "<DATABASE_NAME>",
});
resources:
mydatabase:
type: aiven:MysqlDatabase
properties:
project: ${aiven_project.myproject.project}
serviceName: ${aiven_mysql.mymysql.service_name}
databaseName: <DATABASE_NAME>
Create MysqlDatabase Resource
new MysqlDatabase(name: string, args: MysqlDatabaseArgs, opts?: CustomResourceOptions);
@overload
def MysqlDatabase(resource_name: str,
opts: Optional[ResourceOptions] = None,
database_name: Optional[str] = None,
project: Optional[str] = None,
service_name: Optional[str] = None,
termination_protection: Optional[bool] = None)
@overload
def MysqlDatabase(resource_name: str,
args: MysqlDatabaseArgs,
opts: Optional[ResourceOptions] = None)
func NewMysqlDatabase(ctx *Context, name string, args MysqlDatabaseArgs, opts ...ResourceOption) (*MysqlDatabase, error)
public MysqlDatabase(string name, MysqlDatabaseArgs args, CustomResourceOptions? opts = null)
public MysqlDatabase(String name, MysqlDatabaseArgs args)
public MysqlDatabase(String name, MysqlDatabaseArgs args, CustomResourceOptions options)
type: aiven:MysqlDatabase
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args MysqlDatabaseArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args MysqlDatabaseArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args MysqlDatabaseArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args MysqlDatabaseArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args MysqlDatabaseArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
MysqlDatabase Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
The MysqlDatabase resource accepts the following input properties:
- Database
Name string The name of the service database. This property cannot be changed, doing so forces recreation of the resource.
- Project string
Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
- Service
Name string Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
- Termination
Protection bool It is a Terraform client-side deletion protections, which prevents the database from being deleted by Terraform. It is recommended to enable this for any production databases containing critical data. The default value is
false
.
- Database
Name string The name of the service database. This property cannot be changed, doing so forces recreation of the resource.
- Project string
Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
- Service
Name string Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
- Termination
Protection bool It is a Terraform client-side deletion protections, which prevents the database from being deleted by Terraform. It is recommended to enable this for any production databases containing critical data. The default value is
false
.
- database
Name String The name of the service database. This property cannot be changed, doing so forces recreation of the resource.
- project String
Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
- service
Name String Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
- termination
Protection Boolean It is a Terraform client-side deletion protections, which prevents the database from being deleted by Terraform. It is recommended to enable this for any production databases containing critical data. The default value is
false
.
- database
Name string The name of the service database. This property cannot be changed, doing so forces recreation of the resource.
- project string
Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
- service
Name string Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
- termination
Protection boolean It is a Terraform client-side deletion protections, which prevents the database from being deleted by Terraform. It is recommended to enable this for any production databases containing critical data. The default value is
false
.
- database_
name str The name of the service database. This property cannot be changed, doing so forces recreation of the resource.
- project str
Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
- service_
name str Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
- termination_
protection bool It is a Terraform client-side deletion protections, which prevents the database from being deleted by Terraform. It is recommended to enable this for any production databases containing critical data. The default value is
false
.
- database
Name String The name of the service database. This property cannot be changed, doing so forces recreation of the resource.
- project String
Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
- service
Name String Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
- termination
Protection Boolean It is a Terraform client-side deletion protections, which prevents the database from being deleted by Terraform. It is recommended to enable this for any production databases containing critical data. The default value is
false
.
Outputs
All input properties are implicitly available as output properties. Additionally, the MysqlDatabase resource produces the following output properties:
- Id string
The provider-assigned unique ID for this managed resource.
- Id string
The provider-assigned unique ID for this managed resource.
- id String
The provider-assigned unique ID for this managed resource.
- id string
The provider-assigned unique ID for this managed resource.
- id str
The provider-assigned unique ID for this managed resource.
- id String
The provider-assigned unique ID for this managed resource.
Look up Existing MysqlDatabase Resource
Get an existing MysqlDatabase resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: MysqlDatabaseState, opts?: CustomResourceOptions): MysqlDatabase
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
database_name: Optional[str] = None,
project: Optional[str] = None,
service_name: Optional[str] = None,
termination_protection: Optional[bool] = None) -> MysqlDatabase
func GetMysqlDatabase(ctx *Context, name string, id IDInput, state *MysqlDatabaseState, opts ...ResourceOption) (*MysqlDatabase, error)
public static MysqlDatabase Get(string name, Input<string> id, MysqlDatabaseState? state, CustomResourceOptions? opts = null)
public static MysqlDatabase get(String name, Output<String> id, MysqlDatabaseState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Database
Name string The name of the service database. This property cannot be changed, doing so forces recreation of the resource.
- Project string
Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
- Service
Name string Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
- Termination
Protection bool It is a Terraform client-side deletion protections, which prevents the database from being deleted by Terraform. It is recommended to enable this for any production databases containing critical data. The default value is
false
.
- Database
Name string The name of the service database. This property cannot be changed, doing so forces recreation of the resource.
- Project string
Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
- Service
Name string Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
- Termination
Protection bool It is a Terraform client-side deletion protections, which prevents the database from being deleted by Terraform. It is recommended to enable this for any production databases containing critical data. The default value is
false
.
- database
Name String The name of the service database. This property cannot be changed, doing so forces recreation of the resource.
- project String
Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
- service
Name String Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
- termination
Protection Boolean It is a Terraform client-side deletion protections, which prevents the database from being deleted by Terraform. It is recommended to enable this for any production databases containing critical data. The default value is
false
.
- database
Name string The name of the service database. This property cannot be changed, doing so forces recreation of the resource.
- project string
Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
- service
Name string Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
- termination
Protection boolean It is a Terraform client-side deletion protections, which prevents the database from being deleted by Terraform. It is recommended to enable this for any production databases containing critical data. The default value is
false
.
- database_
name str The name of the service database. This property cannot be changed, doing so forces recreation of the resource.
- project str
Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
- service_
name str Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
- termination_
protection bool It is a Terraform client-side deletion protections, which prevents the database from being deleted by Terraform. It is recommended to enable this for any production databases containing critical data. The default value is
false
.
- database
Name String The name of the service database. This property cannot be changed, doing so forces recreation of the resource.
- project String
Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
- service
Name String Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
- termination
Protection Boolean It is a Terraform client-side deletion protections, which prevents the database from being deleted by Terraform. It is recommended to enable this for any production databases containing critical data. The default value is
false
.
Import
$ pulumi import aiven:index/mysqlDatabase:MysqlDatabase mydatabase project/service_name/database_name
Package Details
- Repository
- Aiven pulumi/pulumi-aiven
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
aiven
Terraform Provider.