published on Thursday, Nov 12, 2026 by planetscale
published on Thursday, Nov 12, 2026 by planetscale
PostgresIPRestriction Resource
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as planetscale from "@pulumi/planetscale";
// Allow connections to every schema, as any role, from these ranges.
const office = new planetscale.PostgresIpRestriction("office", {
organization: "my-organization",
database: "my-database",
cidrs: [
"203.0.113.0/24",
"198.51.100.7/32",
],
description: "Office network and VPN gateway",
});
// Limit one role to the addresses of the hosts that use it.
const reporting = new planetscale.PostgresIpRestriction("reporting", {
organization: "my-organization",
database: "my-database",
role: "reporting",
cidrs: [
"192.0.2.10",
"192.0.2.11",
].map(ip => (`${ip}/32`)),
});
import pulumi
import pulumi_planetscale as planetscale
# Allow connections to every schema, as any role, from these ranges.
office = planetscale.PostgresIpRestriction("office",
organization="my-organization",
database="my-database",
cidrs=[
"203.0.113.0/24",
"198.51.100.7/32",
],
description="Office network and VPN gateway")
# Limit one role to the addresses of the hosts that use it.
reporting = planetscale.PostgresIpRestriction("reporting",
organization="my-organization",
database="my-database",
role="reporting",
cidrs=[f"{ip}/32" for ip in [
"192.0.2.10",
"192.0.2.11",
]])
Example coming soon!
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Planetscale = Pulumi.Planetscale;
return await Deployment.RunAsync(() =>
{
// Allow connections to every schema, as any role, from these ranges.
var office = new Planetscale.PostgresIpRestriction("office", new()
{
Organization = "my-organization",
Database = "my-database",
Cidrs = new[]
{
"203.0.113.0/24",
"198.51.100.7/32",
},
Description = "Office network and VPN gateway",
});
// Limit one role to the addresses of the hosts that use it.
var reporting = new Planetscale.PostgresIpRestriction("reporting", new()
{
Organization = "my-organization",
Database = "my-database",
Role = "reporting",
Cidrs = new[]
{
"192.0.2.10",
"192.0.2.11",
}.Select(ip =>
{
return $"{ip}/32";
}).ToList(),
});
});
Example coming soon!
Example coming soon!
Example coming soon!
Create PostgresIpRestriction Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new PostgresIpRestriction(name: string, args: PostgresIpRestrictionArgs, opts?: CustomResourceOptions);@overload
def PostgresIpRestriction(resource_name: str,
args: PostgresIpRestrictionArgs,
opts: Optional[ResourceOptions] = None)
@overload
def PostgresIpRestriction(resource_name: str,
opts: Optional[ResourceOptions] = None,
cidrs: Optional[Sequence[str]] = None,
database: Optional[str] = None,
organization: Optional[str] = None,
description: Optional[str] = None,
role: Optional[str] = None,
schema: Optional[str] = None)func NewPostgresIpRestriction(ctx *Context, name string, args PostgresIpRestrictionArgs, opts ...ResourceOption) (*PostgresIpRestriction, error)public PostgresIpRestriction(string name, PostgresIpRestrictionArgs args, CustomResourceOptions? opts = null)
public PostgresIpRestriction(String name, PostgresIpRestrictionArgs args)
public PostgresIpRestriction(String name, PostgresIpRestrictionArgs args, CustomResourceOptions options)
type: planetscale:PostgresIpRestriction
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
resource "planetscale_postgres_ip_restriction" "name" {
# resource properties
}Parameters
- name string
- The unique name of the resource.
- args PostgresIpRestrictionArgs
- 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 PostgresIpRestrictionArgs
- 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 PostgresIpRestrictionArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args PostgresIpRestrictionArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args PostgresIpRestrictionArgs
- 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 postgresIpRestrictionResource = new Planetscale.PostgresIpRestriction("postgresIpRestrictionResource", new()
{
Cidrs = new[]
{
"string",
},
Database = "string",
Organization = "string",
Description = "string",
Role = "string",
Schema = "string",
});
example, err := planetscale.NewPostgresIpRestriction(ctx, "postgresIpRestrictionResource", &planetscale.PostgresIpRestrictionArgs{
Cidrs: pulumi.StringArray{
pulumi.String("string"),
},
Database: pulumi.String("string"),
Organization: pulumi.String("string"),
Description: pulumi.String("string"),
Role: pulumi.String("string"),
Schema: pulumi.String("string"),
})
resource "planetscale_postgres_ip_restriction" "postgresIpRestrictionResource" {
lifecycle {
create_before_destroy = true
}
cidrs = ["string"]
database = "string"
organization = "string"
description = "string"
role = "string"
schema = "string"
}
var postgresIpRestrictionResource = new PostgresIpRestriction("postgresIpRestrictionResource", PostgresIpRestrictionArgs.builder()
.cidrs("string")
.database("string")
.organization("string")
.description("string")
.role("string")
.schema("string")
.build());
postgres_ip_restriction_resource = planetscale.PostgresIpRestriction("postgresIpRestrictionResource",
cidrs=["string"],
database="string",
organization="string",
description="string",
role="string",
schema="string")
const postgresIpRestrictionResource = new planetscale.PostgresIpRestriction("postgresIpRestrictionResource", {
cidrs: ["string"],
database: "string",
organization: "string",
description: "string",
role: "string",
schema: "string",
});
type: planetscale:PostgresIpRestriction
properties:
cidrs:
- string
database: string
description: string
organization: string
role: string
schema: string
PostgresIpRestriction 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 PostgresIpRestriction resource accepts the following input properties:
- Cidrs List<string>
- The IPv4 ranges allowed to connect, in CIDR notation, e.g.
["203.0.113.0/24", "198.51.100.7/32"]. Use/32for a single address. - Database string
- The name of the database. Requires replacement if changed.
- Organization string
- The name of the organization the database belongs to. Requires replacement if changed.
- Description string
- A description of the entry, at most 255 characters. Default: ""
- Role string
- The Postgres role the entry applies to. Leave unset to apply to all roles. Default: ""
- Schema string
- The Postgres schema the entry applies to. Leave unset to apply to all schemas. Default: ""
- Cidrs []string
- The IPv4 ranges allowed to connect, in CIDR notation, e.g.
["203.0.113.0/24", "198.51.100.7/32"]. Use/32for a single address. - Database string
- The name of the database. Requires replacement if changed.
- Organization string
- The name of the organization the database belongs to. Requires replacement if changed.
- Description string
- A description of the entry, at most 255 characters. Default: ""
- Role string
- The Postgres role the entry applies to. Leave unset to apply to all roles. Default: ""
- Schema string
- The Postgres schema the entry applies to. Leave unset to apply to all schemas. Default: ""
- cidrs list(string)
- The IPv4 ranges allowed to connect, in CIDR notation, e.g.
["203.0.113.0/24", "198.51.100.7/32"]. Use/32for a single address. - database string
- The name of the database. Requires replacement if changed.
- organization string
- The name of the organization the database belongs to. Requires replacement if changed.
- description string
- A description of the entry, at most 255 characters. Default: ""
- role string
- The Postgres role the entry applies to. Leave unset to apply to all roles. Default: ""
- schema string
- The Postgres schema the entry applies to. Leave unset to apply to all schemas. Default: ""
- cidrs List<String>
- The IPv4 ranges allowed to connect, in CIDR notation, e.g.
["203.0.113.0/24", "198.51.100.7/32"]. Use/32for a single address. - database String
- The name of the database. Requires replacement if changed.
- organization String
- The name of the organization the database belongs to. Requires replacement if changed.
- description String
- A description of the entry, at most 255 characters. Default: ""
- role String
- The Postgres role the entry applies to. Leave unset to apply to all roles. Default: ""
- schema String
- The Postgres schema the entry applies to. Leave unset to apply to all schemas. Default: ""
- cidrs string[]
- The IPv4 ranges allowed to connect, in CIDR notation, e.g.
["203.0.113.0/24", "198.51.100.7/32"]. Use/32for a single address. - database string
- The name of the database. Requires replacement if changed.
- organization string
- The name of the organization the database belongs to. Requires replacement if changed.
- description string
- A description of the entry, at most 255 characters. Default: ""
- role string
- The Postgres role the entry applies to. Leave unset to apply to all roles. Default: ""
- schema string
- The Postgres schema the entry applies to. Leave unset to apply to all schemas. Default: ""
- cidrs Sequence[str]
- The IPv4 ranges allowed to connect, in CIDR notation, e.g.
["203.0.113.0/24", "198.51.100.7/32"]. Use/32for a single address. - database str
- The name of the database. Requires replacement if changed.
- organization str
- The name of the organization the database belongs to. Requires replacement if changed.
- description str
- A description of the entry, at most 255 characters. Default: ""
- role str
- The Postgres role the entry applies to. Leave unset to apply to all roles. Default: ""
- schema str
- The Postgres schema the entry applies to. Leave unset to apply to all schemas. Default: ""
- cidrs List<String>
- The IPv4 ranges allowed to connect, in CIDR notation, e.g.
["203.0.113.0/24", "198.51.100.7/32"]. Use/32for a single address. - database String
- The name of the database. Requires replacement if changed.
- organization String
- The name of the organization the database belongs to. Requires replacement if changed.
- description String
- A description of the entry, at most 255 characters. Default: ""
- role String
- The Postgres role the entry applies to. Leave unset to apply to all roles. Default: ""
- schema String
- The Postgres schema the entry applies to. Leave unset to apply to all schemas. Default: ""
Outputs
All input properties are implicitly available as output properties. Additionally, the PostgresIpRestriction resource produces the following output properties:
- Actor
Postgres
Ip Restriction Actor - Id string
- The provider-assigned unique ID for this managed resource.
- Actor
Postgres
Ip Restriction Actor - Id string
- The provider-assigned unique ID for this managed resource.
- actor
Postgres
Ip Restriction Actor - id String
- The provider-assigned unique ID for this managed resource.
- actor
Postgres
Ip Restriction Actor - id string
- The provider-assigned unique ID for this managed resource.
- actor
Postgres
Ip Restriction Actor - id str
- The provider-assigned unique ID for this managed resource.
- actor Property Map
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing PostgresIpRestriction Resource
Get an existing PostgresIpRestriction 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?: PostgresIpRestrictionState, opts?: CustomResourceOptions): PostgresIpRestriction@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
actor: Optional[PostgresIpRestrictionActorArgs] = None,
cidrs: Optional[Sequence[str]] = None,
database: Optional[str] = None,
description: Optional[str] = None,
organization: Optional[str] = None,
role: Optional[str] = None,
schema: Optional[str] = None) -> PostgresIpRestrictionfunc GetPostgresIpRestriction(ctx *Context, name string, id IDInput, state *PostgresIpRestrictionState, opts ...ResourceOption) (*PostgresIpRestriction, error)public static PostgresIpRestriction Get(string name, Input<string> id, PostgresIpRestrictionState? state, CustomResourceOptions? opts = null)public static PostgresIpRestriction get(String name, Output<String> id, PostgresIpRestrictionState state, CustomResourceOptions options)resources: existingPostgresIpRestriction: type: planetscale:PostgresIpRestriction get: id: ${id}import {
to = planetscale_postgres_ip_restriction.example
id = "${id}"
}
- name string
- The unique name of the resulting resource.
- id Input<ID>
- The unique provider ID of the resource to look up.
- state PostgresIpRestrictionState
- Known property values the provider needs, along with the ID, to find the resource. Usually not required.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resulting resource.
- id str
- The unique provider ID of the resource to look up.
- 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 resulting resource.
- id IDInput
- The unique provider ID of the resource to look up.
- state PostgresIpRestrictionState
- Known property values the provider needs, along with the ID, to find the resource. Usually not required.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resulting resource.
- id Input<string>
- The unique provider ID of the resource to look up.
- state PostgresIpRestrictionState
- Known property values the provider needs, along with the ID, to find the resource. Usually not required.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resulting resource.
- id Output<String>
- The unique provider ID of the resource to look up.
- state PostgresIpRestrictionState
- Known property values the provider needs, along with the ID, to find the resource. Usually not required.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
- Actor
Postgres
Ip Restriction Actor - Cidrs List<string>
- The IPv4 ranges allowed to connect, in CIDR notation, e.g.
["203.0.113.0/24", "198.51.100.7/32"]. Use/32for a single address. - Database string
- The name of the database. Requires replacement if changed.
- Description string
- A description of the entry, at most 255 characters. Default: ""
- Organization string
- The name of the organization the database belongs to. Requires replacement if changed.
- Role string
- The Postgres role the entry applies to. Leave unset to apply to all roles. Default: ""
- Schema string
- The Postgres schema the entry applies to. Leave unset to apply to all schemas. Default: ""
- Actor
Postgres
Ip Restriction Actor Args - Cidrs []string
- The IPv4 ranges allowed to connect, in CIDR notation, e.g.
["203.0.113.0/24", "198.51.100.7/32"]. Use/32for a single address. - Database string
- The name of the database. Requires replacement if changed.
- Description string
- A description of the entry, at most 255 characters. Default: ""
- Organization string
- The name of the organization the database belongs to. Requires replacement if changed.
- Role string
- The Postgres role the entry applies to. Leave unset to apply to all roles. Default: ""
- Schema string
- The Postgres schema the entry applies to. Leave unset to apply to all schemas. Default: ""
- actor object
- cidrs list(string)
- The IPv4 ranges allowed to connect, in CIDR notation, e.g.
["203.0.113.0/24", "198.51.100.7/32"]. Use/32for a single address. - database string
- The name of the database. Requires replacement if changed.
- description string
- A description of the entry, at most 255 characters. Default: ""
- organization string
- The name of the organization the database belongs to. Requires replacement if changed.
- role string
- The Postgres role the entry applies to. Leave unset to apply to all roles. Default: ""
- schema string
- The Postgres schema the entry applies to. Leave unset to apply to all schemas. Default: ""
- actor
Postgres
Ip Restriction Actor - cidrs List<String>
- The IPv4 ranges allowed to connect, in CIDR notation, e.g.
["203.0.113.0/24", "198.51.100.7/32"]. Use/32for a single address. - database String
- The name of the database. Requires replacement if changed.
- description String
- A description of the entry, at most 255 characters. Default: ""
- organization String
- The name of the organization the database belongs to. Requires replacement if changed.
- role String
- The Postgres role the entry applies to. Leave unset to apply to all roles. Default: ""
- schema String
- The Postgres schema the entry applies to. Leave unset to apply to all schemas. Default: ""
- actor
Postgres
Ip Restriction Actor - cidrs string[]
- The IPv4 ranges allowed to connect, in CIDR notation, e.g.
["203.0.113.0/24", "198.51.100.7/32"]. Use/32for a single address. - database string
- The name of the database. Requires replacement if changed.
- description string
- A description of the entry, at most 255 characters. Default: ""
- organization string
- The name of the organization the database belongs to. Requires replacement if changed.
- role string
- The Postgres role the entry applies to. Leave unset to apply to all roles. Default: ""
- schema string
- The Postgres schema the entry applies to. Leave unset to apply to all schemas. Default: ""
- actor
Postgres
Ip Restriction Actor Args - cidrs Sequence[str]
- The IPv4 ranges allowed to connect, in CIDR notation, e.g.
["203.0.113.0/24", "198.51.100.7/32"]. Use/32for a single address. - database str
- The name of the database. Requires replacement if changed.
- description str
- A description of the entry, at most 255 characters. Default: ""
- organization str
- The name of the organization the database belongs to. Requires replacement if changed.
- role str
- The Postgres role the entry applies to. Leave unset to apply to all roles. Default: ""
- schema str
- The Postgres schema the entry applies to. Leave unset to apply to all schemas. Default: ""
- actor Property Map
- cidrs List<String>
- The IPv4 ranges allowed to connect, in CIDR notation, e.g.
["203.0.113.0/24", "198.51.100.7/32"]. Use/32for a single address. - database String
- The name of the database. Requires replacement if changed.
- description String
- A description of the entry, at most 255 characters. Default: ""
- organization String
- The name of the organization the database belongs to. Requires replacement if changed.
- role String
- The Postgres role the entry applies to. Leave unset to apply to all roles. Default: ""
- schema String
- The Postgres schema the entry applies to. Leave unset to apply to all schemas. Default: ""
Supporting Types
PostgresIpRestrictionActor, PostgresIpRestrictionActorArgs
- Id string
- The ID of the actor
- Id string
- The ID of the actor
- id string
- The ID of the actor
- id String
- The ID of the actor
- id string
- The ID of the actor
- id str
- The ID of the actor
- id String
- The ID of the actor
Import
In Terraform v1.5.0 and later, the import block can be used with the id attribute, for example:
terraform
import {
to = planetscale_postgres_ip_restriction.my_planetscale_postgres_ip_restriction
id = jsonencode({
database = "..."
id = "..."
organization = "..."
})
}
The pulumi import command can be used, for example:
$ pulumi import planetscale:index/postgresIpRestriction:PostgresIpRestriction my_planetscale_postgres_ip_restriction '{"database": "...", "id": "...", "organization": "..."}'
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- planetscale planetscale/terraform-provider-planetscale
- License
- Notes
- This Pulumi package is based on the
planetscaleTerraform Provider.
published on Thursday, Nov 12, 2026 by planetscale