linode.DatabaseAccessControls
Explore with Pulumi AI
Manages the access control for a Linode Database. Only one linode.DatabaseAccessControls
resource should be defined per-database.
For more information, see the Linode APIv4 docs for MySQL and PostgreSQL.
Example Usage
Grant a Linode access to a database:
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.19",
});
const my_db = new linode.DatabaseMysql("my-db", {
label: "mydatabase",
engineId: "mysql/8.0.30",
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],
});
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.19")
my_db = linode.DatabaseMysql("my-db",
label="mydatabase",
engine_id="mysql/8.0.30",
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])
package main
import (
"github.com/pulumi/pulumi-linode/sdk/v4/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.19"),
})
if err != nil {
return err
}
_, err = linode.NewDatabaseMysql(ctx, "my-db", &linode.DatabaseMysqlArgs{
Label: pulumi.String("mydatabase"),
EngineId: pulumi.String("mysql/8.0.30"),
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
})
}
using System.Collections.Generic;
using System.Linq;
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.19",
});
var my_db = new Linode.DatabaseMysql("my-db", new()
{
Label = "mydatabase",
EngineId = "mysql/8.0.30",
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 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.19")
.build());
var my_db = new DatabaseMysql("my-db", DatabaseMysqlArgs.builder()
.label("mydatabase")
.engineId("mysql/8.0.30")
.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());
}
}
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.19
my-db:
type: linode:DatabaseMysql
properties:
label: mydatabase
engineId: mysql/8.0.30
region: us-southeast
type: g6-nanode-1
Create DatabaseAccessControls Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new DatabaseAccessControls(name: string, args: DatabaseAccessControlsArgs, opts?: CustomResourceOptions);
@overload
def DatabaseAccessControls(resource_name: str,
args: DatabaseAccessControlsArgs,
opts: Optional[ResourceOptions] = None)
@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)
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.
Parameters
- 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.
Constructor example
The following reference example uses placeholder values for all input properties.
var databaseAccessControlsResource = new Linode.DatabaseAccessControls("databaseAccessControlsResource", new()
{
AllowLists = new[]
{
"string",
},
DatabaseId = 0,
DatabaseType = "string",
});
example, err := linode.NewDatabaseAccessControls(ctx, "databaseAccessControlsResource", &linode.DatabaseAccessControlsArgs{
AllowLists: pulumi.StringArray{
pulumi.String("string"),
},
DatabaseId: pulumi.Int(0),
DatabaseType: pulumi.String("string"),
})
var databaseAccessControlsResource = new DatabaseAccessControls("databaseAccessControlsResource", DatabaseAccessControlsArgs.builder()
.allowLists("string")
.databaseId(0)
.databaseType("string")
.build());
database_access_controls_resource = linode.DatabaseAccessControls("databaseAccessControlsResource",
allow_lists=["string"],
database_id=0,
database_type="string")
const databaseAccessControlsResource = new linode.DatabaseAccessControls("databaseAccessControlsResource", {
allowLists: ["string"],
databaseId: 0,
databaseType: "string",
});
type: linode:DatabaseAccessControls
properties:
allowLists:
- string
databaseId: 0
databaseType: string
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
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The DatabaseAccessControls resource accepts the following input properties:
- Allow
Lists 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.
- Database
Id int - The unique ID of the target database.
- Database
Type string - The unique type of the target database. (
mysql
,postgresql
)
- Allow
Lists []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.
- Database
Id int - The unique ID of the target database.
- Database
Type string - The unique type of the target database. (
mysql
,postgresql
)
- allow
Lists 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.
- database
Id Integer - The unique ID of the target database.
- database
Type String - The unique type of the target database. (
mysql
,postgresql
)
- allow
Lists 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.
- database
Id number - The unique ID of the target database.
- database
Type string - The unique type of the target database. (
mysql
,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
,postgresql
)
- allow
Lists 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.
- database
Id Number - The unique ID of the target database.
- database
Type String - The unique type of the target database. (
mysql
,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 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.
- Allow
Lists 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.
- Database
Id int - The unique ID of the target database.
- Database
Type string - The unique type of the target database. (
mysql
,postgresql
)
- Allow
Lists []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.
- Database
Id int - The unique ID of the target database.
- Database
Type string - The unique type of the target database. (
mysql
,postgresql
)
- allow
Lists 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.
- database
Id Integer - The unique ID of the target database.
- database
Type String - The unique type of the target database. (
mysql
,postgresql
)
- allow
Lists 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.
- database
Id number - The unique ID of the target database.
- database
Type string - The unique type of the target database. (
mysql
,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
,postgresql
)
- allow
Lists 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.
- database
Id Number - The unique ID of the target database.
- database
Type String - The unique type of the target database. (
mysql
,postgresql
)
Package Details
- Repository
- Linode pulumi/pulumi-linode
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
linode
Terraform Provider.