openstack.database.Database
Explore with Pulumi AI
Manages a V1 DB database resource within OpenStack.
Example Usage
Database
import * as pulumi from "@pulumi/pulumi";
import * as openstack from "@pulumi/openstack";
const mydb = new openstack.database.Database("mydb", {
name: "mydb",
instanceId: basic.id,
});
import pulumi
import pulumi_openstack as openstack
mydb = openstack.database.Database("mydb",
name="mydb",
instance_id=basic["id"])
package main
import (
"github.com/pulumi/pulumi-openstack/sdk/v4/go/openstack/database"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := database.NewDatabase(ctx, "mydb", &database.DatabaseArgs{
Name: pulumi.String("mydb"),
InstanceId: pulumi.Any(basic.Id),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using OpenStack = Pulumi.OpenStack;
return await Deployment.RunAsync(() =>
{
var mydb = new OpenStack.Database.Database("mydb", new()
{
Name = "mydb",
InstanceId = basic.Id,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.openstack.database.Database;
import com.pulumi.openstack.database.DatabaseArgs;
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 mydb = new Database("mydb", DatabaseArgs.builder()
.name("mydb")
.instanceId(basic.id())
.build());
}
}
resources:
mydb:
type: openstack:database:Database
properties:
name: mydb
instanceId: ${basic.id}
Create Database Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Database(name: string, args: DatabaseArgs, opts?: CustomResourceOptions);
@overload
def Database(resource_name: str,
args: DatabaseArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Database(resource_name: str,
opts: Optional[ResourceOptions] = None,
instance_id: Optional[str] = None,
name: Optional[str] = None,
region: Optional[str] = None)
func NewDatabase(ctx *Context, name string, args DatabaseArgs, opts ...ResourceOption) (*Database, error)
public Database(string name, DatabaseArgs args, CustomResourceOptions? opts = null)
public Database(String name, DatabaseArgs args)
public Database(String name, DatabaseArgs args, CustomResourceOptions options)
type: openstack:database:Database
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 DatabaseArgs
- 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 DatabaseArgs
- 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 DatabaseArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args DatabaseArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args DatabaseArgs
- 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 databaseResource = new OpenStack.Database.Database("databaseResource", new()
{
InstanceId = "string",
Name = "string",
Region = "string",
});
example, err := database.NewDatabase(ctx, "databaseResource", &database.DatabaseArgs{
InstanceId: pulumi.String("string"),
Name: pulumi.String("string"),
Region: pulumi.String("string"),
})
var databaseResource = new Database("databaseResource", DatabaseArgs.builder()
.instanceId("string")
.name("string")
.region("string")
.build());
database_resource = openstack.database.Database("databaseResource",
instance_id="string",
name="string",
region="string")
const databaseResource = new openstack.database.Database("databaseResource", {
instanceId: "string",
name: "string",
region: "string",
});
type: openstack:database:Database
properties:
instanceId: string
name: string
region: string
Database 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 Database resource accepts the following input properties:
- Instance
Id string - The ID for the database instance.
- Name string
- A unique name for the resource.
- Region string
- Openstack region resource is created in.
- Instance
Id string - The ID for the database instance.
- Name string
- A unique name for the resource.
- Region string
- Openstack region resource is created in.
- instance
Id String - The ID for the database instance.
- name String
- A unique name for the resource.
- region String
- Openstack region resource is created in.
- instance
Id string - The ID for the database instance.
- name string
- A unique name for the resource.
- region string
- Openstack region resource is created in.
- instance_
id str - The ID for the database instance.
- name str
- A unique name for the resource.
- region str
- Openstack region resource is created in.
- instance
Id String - The ID for the database instance.
- name String
- A unique name for the resource.
- region String
- Openstack region resource is created in.
Outputs
All input properties are implicitly available as output properties. Additionally, the Database 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 Database Resource
Get an existing Database 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?: DatabaseState, opts?: CustomResourceOptions): Database
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
instance_id: Optional[str] = None,
name: Optional[str] = None,
region: Optional[str] = None) -> Database
func GetDatabase(ctx *Context, name string, id IDInput, state *DatabaseState, opts ...ResourceOption) (*Database, error)
public static Database Get(string name, Input<string> id, DatabaseState? state, CustomResourceOptions? opts = null)
public static Database get(String name, Output<String> id, DatabaseState 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.
- Instance
Id string - The ID for the database instance.
- Name string
- A unique name for the resource.
- Region string
- Openstack region resource is created in.
- Instance
Id string - The ID for the database instance.
- Name string
- A unique name for the resource.
- Region string
- Openstack region resource is created in.
- instance
Id String - The ID for the database instance.
- name String
- A unique name for the resource.
- region String
- Openstack region resource is created in.
- instance
Id string - The ID for the database instance.
- name string
- A unique name for the resource.
- region string
- Openstack region resource is created in.
- instance_
id str - The ID for the database instance.
- name str
- A unique name for the resource.
- region str
- Openstack region resource is created in.
- instance
Id String - The ID for the database instance.
- name String
- A unique name for the resource.
- region String
- Openstack region resource is created in.
Import
Databases can be imported by using instance-id/db-name
, e.g.
$ pulumi import openstack:database/database:Database mydb 7b9e3cd3-00d9-449c-b074-8439f8e274fa/mydb
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- OpenStack pulumi/pulumi-openstack
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
openstack
Terraform Provider.