Linode

v3.10.1 published on Tuesday, Aug 30, 2022 by Pulumi

DatabaseAccessControls

Manages the access control for a Linode Database. Only one linode.DatabaseAccessControls resource should be defined per-database.

Example Usage

using System.Collections.Generic;
using Pulumi;
using Linode = Pulumi.Linode;

return await Deployment.RunAsync(() => 
{
    var my_instance = new Linode.Instance("my-instance", new()
    {
        Label = "myinstance",
        Region = "us-southeast",
        Type = "g6-nanode-1",
        Image = "linode/alpine3.14",
    });

    var my_db = new Linode.DatabaseMysql("my-db", new()
    {
        Label = "mydatabase",
        EngineId = "mysql/8.0.26",
        Region = "us-southeast",
        Type = "g6-nanode-1",
    });

    var my_access = new Linode.DatabaseAccessControls("my-access", new()
    {
        DatabaseId = my_db.Id,
        DatabaseType = "mysql",
        AllowLists = new[]
        {
            my_instance.IpAddress,
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-linode/sdk/v3/go/linode"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := linode.NewInstance(ctx, "my-instance", &linode.InstanceArgs{
			Label:  pulumi.String("myinstance"),
			Region: pulumi.String("us-southeast"),
			Type:   pulumi.String("g6-nanode-1"),
			Image:  pulumi.String("linode/alpine3.14"),
		})
		if err != nil {
			return err
		}
		_, err = linode.NewDatabaseMysql(ctx, "my-db", &linode.DatabaseMysqlArgs{
			Label:    pulumi.String("mydatabase"),
			EngineId: pulumi.String("mysql/8.0.26"),
			Region:   pulumi.String("us-southeast"),
			Type:     pulumi.String("g6-nanode-1"),
		})
		if err != nil {
			return err
		}
		_, err = linode.NewDatabaseAccessControls(ctx, "my-access", &linode.DatabaseAccessControlsArgs{
			DatabaseId:   my_db.ID(),
			DatabaseType: pulumi.String("mysql"),
			AllowLists: pulumi.StringArray{
				my_instance.IpAddress,
			},
		})
		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.linode.Instance;
import com.pulumi.linode.InstanceArgs;
import com.pulumi.linode.DatabaseMysql;
import com.pulumi.linode.DatabaseMysqlArgs;
import com.pulumi.linode.DatabaseAccessControls;
import com.pulumi.linode.DatabaseAccessControlsArgs;
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 my_instance = new Instance("my-instance", InstanceArgs.builder()        
            .label("myinstance")
            .region("us-southeast")
            .type("g6-nanode-1")
            .image("linode/alpine3.14")
            .build());

        var my_db = new DatabaseMysql("my-db", DatabaseMysqlArgs.builder()        
            .label("mydatabase")
            .engineId("mysql/8.0.26")
            .region("us-southeast")
            .type("g6-nanode-1")
            .build());

        var my_access = new DatabaseAccessControls("my-access", DatabaseAccessControlsArgs.builder()        
            .databaseId(my_db.id())
            .databaseType("mysql")
            .allowLists(my_instance.ipAddress())
            .build());

    }
}
import pulumi
import pulumi_linode as linode

my_instance = linode.Instance("my-instance",
    label="myinstance",
    region="us-southeast",
    type="g6-nanode-1",
    image="linode/alpine3.14")
my_db = linode.DatabaseMysql("my-db",
    label="mydatabase",
    engine_id="mysql/8.0.26",
    region="us-southeast",
    type="g6-nanode-1")
my_access = linode.DatabaseAccessControls("my-access",
    database_id=my_db.id,
    database_type="mysql",
    allow_lists=[my_instance.ip_address])
import * as pulumi from "@pulumi/pulumi";
import * as linode from "@pulumi/linode";

const my_instance = new linode.Instance("my-instance", {
    label: "myinstance",
    region: "us-southeast",
    type: "g6-nanode-1",
    image: "linode/alpine3.14",
});
const my_db = new linode.DatabaseMysql("my-db", {
    label: "mydatabase",
    engineId: "mysql/8.0.26",
    region: "us-southeast",
    type: "g6-nanode-1",
});
const my_access = new linode.DatabaseAccessControls("my-access", {
    databaseId: my_db.id,
    databaseType: "mysql",
    allowLists: [my_instance.ipAddress],
});
resources:
  my-access:
    type: linode:DatabaseAccessControls
    properties:
      databaseId: ${["my-db"].id}
      databaseType: mysql
      allowLists:
        - ${["my-instance"].ipAddress}
  my-instance:
    type: linode:Instance
    properties:
      label: myinstance
      region: us-southeast
      type: g6-nanode-1
      image: linode/alpine3.14
  my-db:
    type: linode:DatabaseMysql
    properties:
      label: mydatabase
      engineId: mysql/8.0.26
      region: us-southeast
      type: g6-nanode-1

Create a DatabaseAccessControls Resource

new DatabaseAccessControls(name: string, args: DatabaseAccessControlsArgs, opts?: CustomResourceOptions);
@overload
def DatabaseAccessControls(resource_name: str,
                           opts: Optional[ResourceOptions] = None,
                           allow_lists: Optional[Sequence[str]] = None,
                           database_id: Optional[int] = None,
                           database_type: Optional[str] = None)
@overload
def DatabaseAccessControls(resource_name: str,
                           args: DatabaseAccessControlsArgs,
                           opts: Optional[ResourceOptions] = None)
func NewDatabaseAccessControls(ctx *Context, name string, args DatabaseAccessControlsArgs, opts ...ResourceOption) (*DatabaseAccessControls, error)
public DatabaseAccessControls(string name, DatabaseAccessControlsArgs args, CustomResourceOptions? opts = null)
public DatabaseAccessControls(String name, DatabaseAccessControlsArgs args)
public DatabaseAccessControls(String name, DatabaseAccessControlsArgs args, CustomResourceOptions options)
type: linode:DatabaseAccessControls
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args DatabaseAccessControlsArgs
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 DatabaseAccessControlsArgs
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 DatabaseAccessControlsArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args DatabaseAccessControlsArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args DatabaseAccessControlsArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

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

AllowLists List<string>

A list of IP addresses that can access the Managed Database. Each item can be a single IP address or a range in CIDR format.

DatabaseId int

The unique ID of the target database.

DatabaseType string

The unique type of the target database. (mysql, mongodb, postgresql)

AllowLists []string

A list of IP addresses that can access the Managed Database. Each item can be a single IP address or a range in CIDR format.

DatabaseId int

The unique ID of the target database.

DatabaseType string

The unique type of the target database. (mysql, mongodb, postgresql)

allowLists List<String>

A list of IP addresses that can access the Managed Database. Each item can be a single IP address or a range in CIDR format.

databaseId Integer

The unique ID of the target database.

databaseType String

The unique type of the target database. (mysql, mongodb, postgresql)

allowLists string[]

A list of IP addresses that can access the Managed Database. Each item can be a single IP address or a range in CIDR format.

databaseId number

The unique ID of the target database.

databaseType string

The unique type of the target database. (mysql, mongodb, postgresql)

allow_lists Sequence[str]

A list of IP addresses that can access the Managed Database. Each item can be a single IP address or a range in CIDR format.

database_id int

The unique ID of the target database.

database_type str

The unique type of the target database. (mysql, mongodb, postgresql)

allowLists List<String>

A list of IP addresses that can access the Managed Database. Each item can be a single IP address or a range in CIDR format.

databaseId Number

The unique ID of the target database.

databaseType String

The unique type of the target database. (mysql, mongodb, postgresql)

Outputs

All input properties are implicitly available as output properties. Additionally, the DatabaseAccessControls 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 an Existing DatabaseAccessControls Resource

Get an existing DatabaseAccessControls 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?: DatabaseAccessControlsState, opts?: CustomResourceOptions): DatabaseAccessControls
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        allow_lists: Optional[Sequence[str]] = None,
        database_id: Optional[int] = None,
        database_type: Optional[str] = None) -> DatabaseAccessControls
func GetDatabaseAccessControls(ctx *Context, name string, id IDInput, state *DatabaseAccessControlsState, opts ...ResourceOption) (*DatabaseAccessControls, error)
public static DatabaseAccessControls Get(string name, Input<string> id, DatabaseAccessControlsState? state, CustomResourceOptions? opts = null)
public static DatabaseAccessControls get(String name, Output<String> id, DatabaseAccessControlsState 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:
AllowLists List<string>

A list of IP addresses that can access the Managed Database. Each item can be a single IP address or a range in CIDR format.

DatabaseId int

The unique ID of the target database.

DatabaseType string

The unique type of the target database. (mysql, mongodb, postgresql)

AllowLists []string

A list of IP addresses that can access the Managed Database. Each item can be a single IP address or a range in CIDR format.

DatabaseId int

The unique ID of the target database.

DatabaseType string

The unique type of the target database. (mysql, mongodb, postgresql)

allowLists List<String>

A list of IP addresses that can access the Managed Database. Each item can be a single IP address or a range in CIDR format.

databaseId Integer

The unique ID of the target database.

databaseType String

The unique type of the target database. (mysql, mongodb, postgresql)

allowLists string[]

A list of IP addresses that can access the Managed Database. Each item can be a single IP address or a range in CIDR format.

databaseId number

The unique ID of the target database.

databaseType string

The unique type of the target database. (mysql, mongodb, postgresql)

allow_lists Sequence[str]

A list of IP addresses that can access the Managed Database. Each item can be a single IP address or a range in CIDR format.

database_id int

The unique ID of the target database.

database_type str

The unique type of the target database. (mysql, mongodb, postgresql)

allowLists List<String>

A list of IP addresses that can access the Managed Database. Each item can be a single IP address or a range in CIDR format.

databaseId Number

The unique ID of the target database.

databaseType String

The unique type of the target database. (mysql, mongodb, postgresql)

Package Details

Repository
https://github.com/pulumi/pulumi-linode
License
Apache-2.0
Notes

This Pulumi package is based on the linode Terraform Provider.