1. Packages
  2. Cloudflare
  3. API Docs
  4. D1Database
Cloudflare v5.26.0 published on Wednesday, Apr 17, 2024 by Pulumi

cloudflare.D1Database

Explore with Pulumi AI

cloudflare logo
Cloudflare v5.26.0 published on Wednesday, Apr 17, 2024 by Pulumi

    The D1 Database resource allows you to manage Cloudflare D1 databases.

    !> When a D1 Database is replaced all the data is lost. Please ensure you have a backup of your data before replacing a D1 Database.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as cloudflare from "@pulumi/cloudflare";
    
    const example = new cloudflare.D1Database("example", {
        accountId: "f037e56e89293a057740de681ac9abbe",
        name: "terraform-database",
    });
    
    import pulumi
    import pulumi_cloudflare as cloudflare
    
    example = cloudflare.D1Database("example",
        account_id="f037e56e89293a057740de681ac9abbe",
        name="terraform-database")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-cloudflare/sdk/v5/go/cloudflare"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := cloudflare.NewD1Database(ctx, "example", &cloudflare.D1DatabaseArgs{
    			AccountId: pulumi.String("f037e56e89293a057740de681ac9abbe"),
    			Name:      pulumi.String("terraform-database"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Cloudflare = Pulumi.Cloudflare;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Cloudflare.D1Database("example", new()
        {
            AccountId = "f037e56e89293a057740de681ac9abbe",
            Name = "terraform-database",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.cloudflare.D1Database;
    import com.pulumi.cloudflare.D1DatabaseArgs;
    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 example = new D1Database("example", D1DatabaseArgs.builder()        
                .accountId("f037e56e89293a057740de681ac9abbe")
                .name("terraform-database")
                .build());
    
        }
    }
    
    resources:
      example:
        type: cloudflare:D1Database
        properties:
          accountId: f037e56e89293a057740de681ac9abbe
          name: terraform-database
    

    Create D1Database Resource

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

    Constructor syntax

    new D1Database(name: string, args: D1DatabaseArgs, opts?: CustomResourceOptions);
    @overload
    def D1Database(resource_name: str,
                   args: D1DatabaseArgs,
                   opts: Optional[ResourceOptions] = None)
    
    @overload
    def D1Database(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   account_id: Optional[str] = None,
                   name: Optional[str] = None)
    func NewD1Database(ctx *Context, name string, args D1DatabaseArgs, opts ...ResourceOption) (*D1Database, error)
    public D1Database(string name, D1DatabaseArgs args, CustomResourceOptions? opts = null)
    public D1Database(String name, D1DatabaseArgs args)
    public D1Database(String name, D1DatabaseArgs args, CustomResourceOptions options)
    
    type: cloudflare:D1Database
    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 D1DatabaseArgs
    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 D1DatabaseArgs
    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 D1DatabaseArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args D1DatabaseArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args D1DatabaseArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

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

    var d1databaseResource = new Cloudflare.D1Database("d1databaseResource", new()
    {
        AccountId = "string",
        Name = "string",
    });
    
    example, err := cloudflare.NewD1Database(ctx, "d1databaseResource", &cloudflare.D1DatabaseArgs{
    	AccountId: pulumi.String("string"),
    	Name:      pulumi.String("string"),
    })
    
    var d1databaseResource = new D1Database("d1databaseResource", D1DatabaseArgs.builder()        
        .accountId("string")
        .name("string")
        .build());
    
    d1database_resource = cloudflare.D1Database("d1databaseResource",
        account_id="string",
        name="string")
    
    const d1databaseResource = new cloudflare.D1Database("d1databaseResource", {
        accountId: "string",
        name: "string",
    });
    
    type: cloudflare:D1Database
    properties:
        accountId: string
        name: string
    

    D1Database 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 D1Database resource accepts the following input properties:

    AccountId string
    The account identifier to target for the resource.
    Name string
    The name of the D1 Database.
    AccountId string
    The account identifier to target for the resource.
    Name string
    The name of the D1 Database.
    accountId String
    The account identifier to target for the resource.
    name String
    The name of the D1 Database.
    accountId string
    The account identifier to target for the resource.
    name string
    The name of the D1 Database.
    account_id str
    The account identifier to target for the resource.
    name str
    The name of the D1 Database.
    accountId String
    The account identifier to target for the resource.
    name String
    The name of the D1 Database.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the D1Database resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Version string
    The backend version of the database.
    Id string
    The provider-assigned unique ID for this managed resource.
    Version string
    The backend version of the database.
    id String
    The provider-assigned unique ID for this managed resource.
    version String
    The backend version of the database.
    id string
    The provider-assigned unique ID for this managed resource.
    version string
    The backend version of the database.
    id str
    The provider-assigned unique ID for this managed resource.
    version str
    The backend version of the database.
    id String
    The provider-assigned unique ID for this managed resource.
    version String
    The backend version of the database.

    Look up Existing D1Database Resource

    Get an existing D1Database 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?: D1DatabaseState, opts?: CustomResourceOptions): D1Database
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            account_id: Optional[str] = None,
            name: Optional[str] = None,
            version: Optional[str] = None) -> D1Database
    func GetD1Database(ctx *Context, name string, id IDInput, state *D1DatabaseState, opts ...ResourceOption) (*D1Database, error)
    public static D1Database Get(string name, Input<string> id, D1DatabaseState? state, CustomResourceOptions? opts = null)
    public static D1Database get(String name, Output<String> id, D1DatabaseState 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:
    AccountId string
    The account identifier to target for the resource.
    Name string
    The name of the D1 Database.
    Version string
    The backend version of the database.
    AccountId string
    The account identifier to target for the resource.
    Name string
    The name of the D1 Database.
    Version string
    The backend version of the database.
    accountId String
    The account identifier to target for the resource.
    name String
    The name of the D1 Database.
    version String
    The backend version of the database.
    accountId string
    The account identifier to target for the resource.
    name string
    The name of the D1 Database.
    version string
    The backend version of the database.
    account_id str
    The account identifier to target for the resource.
    name str
    The name of the D1 Database.
    version str
    The backend version of the database.
    accountId String
    The account identifier to target for the resource.
    name String
    The name of the D1 Database.
    version String
    The backend version of the database.

    Import

    $ pulumi import cloudflare:index/d1Database:D1Database example <account id>/<database id>
    

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

    Package Details

    Repository
    Cloudflare pulumi/pulumi-cloudflare
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the cloudflare Terraform Provider.
    cloudflare logo
    Cloudflare v5.26.0 published on Wednesday, Apr 17, 2024 by Pulumi