1. Packages
  2. Aiven Provider
  3. API Docs
  4. MysqlDatabase
Aiven v6.25.0 published on Friday, Sep 27, 2024 by Pulumi

aiven.MysqlDatabase

Explore with Pulumi AI

aiven logo
Aiven v6.25.0 published on Friday, Sep 27, 2024 by Pulumi

    The MySQL Database resource allows the creation and management of Aiven MySQL Databases.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aiven from "@pulumi/aiven";
    
    const mydatabase = new aiven.MysqlDatabase("mydatabase", {
        project: myproject.project,
        serviceName: mymysql.serviceName,
        databaseName: "<DATABASE_NAME>",
    });
    
    import pulumi
    import pulumi_aiven as aiven
    
    mydatabase = aiven.MysqlDatabase("mydatabase",
        project=myproject["project"],
        service_name=mymysql["serviceName"],
        database_name="<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(myproject.Project),
    			ServiceName:  pulumi.Any(mymysql.ServiceName),
    			DatabaseName: pulumi.String("<DATABASE_NAME>"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    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 = myproject.Project,
            ServiceName = mymysql.ServiceName,
            DatabaseName = "<DATABASE_NAME>",
        });
    
    });
    
    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(myproject.project())
                .serviceName(mymysql.serviceName())
                .databaseName("<DATABASE_NAME>")
                .build());
    
        }
    }
    
    resources:
      mydatabase:
        type: aiven:MysqlDatabase
        properties:
          project: ${myproject.project}
          serviceName: ${mymysql.serviceName}
          databaseName: <DATABASE_NAME>
    

    Create MysqlDatabase Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new MysqlDatabase(name: string, args: MysqlDatabaseArgs, opts?: CustomResourceOptions);
    @overload
    def MysqlDatabase(resource_name: str,
                      args: MysqlDatabaseArgs,
                      opts: Optional[ResourceOptions] = None)
    
    @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)
    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.
    
    

    Parameters

    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.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var mysqlDatabaseResource = new Aiven.MysqlDatabase("mysqlDatabaseResource", new()
    {
        DatabaseName = "string",
        Project = "string",
        ServiceName = "string",
        TerminationProtection = false,
    });
    
    example, err := aiven.NewMysqlDatabase(ctx, "mysqlDatabaseResource", &aiven.MysqlDatabaseArgs{
    	DatabaseName:          pulumi.String("string"),
    	Project:               pulumi.String("string"),
    	ServiceName:           pulumi.String("string"),
    	TerminationProtection: pulumi.Bool(false),
    })
    
    var mysqlDatabaseResource = new MysqlDatabase("mysqlDatabaseResource", MysqlDatabaseArgs.builder()
        .databaseName("string")
        .project("string")
        .serviceName("string")
        .terminationProtection(false)
        .build());
    
    mysql_database_resource = aiven.MysqlDatabase("mysqlDatabaseResource",
        database_name="string",
        project="string",
        service_name="string",
        termination_protection=False)
    
    const mysqlDatabaseResource = new aiven.MysqlDatabase("mysqlDatabaseResource", {
        databaseName: "string",
        project: "string",
        serviceName: "string",
        terminationProtection: false,
    });
    
    type: aiven:MysqlDatabase
    properties:
        databaseName: string
        project: string
        serviceName: string
        terminationProtection: false
    

    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:

    DatabaseName string
    The name of the service database. Changing this property forces recreation of the resource.
    Project string
    The name of the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    ServiceName string
    The name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    TerminationProtection bool
    DatabaseName string
    The name of the service database. Changing this property forces recreation of the resource.
    Project string
    The name of the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    ServiceName string
    The name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    TerminationProtection bool
    databaseName String
    The name of the service database. Changing this property forces recreation of the resource.
    project String
    The name of the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    serviceName String
    The name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    terminationProtection Boolean
    databaseName string
    The name of the service database. Changing this property forces recreation of the resource.
    project string
    The name of the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    serviceName string
    The name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    terminationProtection boolean
    database_name str
    The name of the service database. Changing this property forces recreation of the resource.
    project str
    The name of the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    service_name str
    The name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    termination_protection bool
    databaseName String
    The name of the service database. Changing this property forces recreation of the resource.
    project String
    The name of the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    serviceName String
    The name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    terminationProtection Boolean

    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.
    The following state arguments are supported:
    DatabaseName string
    The name of the service database. Changing this property forces recreation of the resource.
    Project string
    The name of the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    ServiceName string
    The name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    TerminationProtection bool
    DatabaseName string
    The name of the service database. Changing this property forces recreation of the resource.
    Project string
    The name of the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    ServiceName string
    The name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    TerminationProtection bool
    databaseName String
    The name of the service database. Changing this property forces recreation of the resource.
    project String
    The name of the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    serviceName String
    The name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    terminationProtection Boolean
    databaseName string
    The name of the service database. Changing this property forces recreation of the resource.
    project string
    The name of the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    serviceName string
    The name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    terminationProtection boolean
    database_name str
    The name of the service database. Changing this property forces recreation of the resource.
    project str
    The name of the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    service_name str
    The name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    termination_protection bool
    databaseName String
    The name of the service database. Changing this property forces recreation of the resource.
    project String
    The name of the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    serviceName String
    The name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    terminationProtection Boolean

    Import

    $ pulumi import aiven:index/mysqlDatabase:MysqlDatabase mydatabase PROJECT/SERVICE_NAME/DATABASE_NAME
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Aiven pulumi/pulumi-aiven
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aiven Terraform Provider.
    aiven logo
    Aiven v6.25.0 published on Friday, Sep 27, 2024 by Pulumi