1. Packages
  2. Packages
  3. Defang Providers
  4. API Docs
  5. Postgres
Viewing docs for Defang Azure v2.4.1
published on Saturday, Jul 11, 2026 by Defang
defang-azure logo
Viewing docs for Defang Azure v2.4.1
published on Saturday, Jul 11, 2026 by Defang

    Create Postgres Resource

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

    Constructor syntax

    new Postgres(name: string, args: PostgresArgs, opts?: ComponentResourceOptions);
    @overload
    def Postgres(resource_name: str,
                 args: PostgresArgs,
                 opts: Optional[ResourceOptions] = None)
    
    @overload
    def Postgres(resource_name: str,
                 opts: Optional[ResourceOptions] = None,
                 project_name: Optional[str] = None,
                 deploy: Optional[_compose.DeployConfigArgs] = None,
                 environment: Optional[Mapping[str, str]] = None,
                 image: Optional[str] = None,
                 postgres: Optional[_compose.PostgresConfigArgs] = None)
    func NewPostgres(ctx *Context, name string, args PostgresArgs, opts ...ResourceOption) (*Postgres, error)
    public Postgres(string name, PostgresArgs args, ComponentResourceOptions? opts = null)
    public Postgres(String name, PostgresArgs args)
    public Postgres(String name, PostgresArgs args, ComponentResourceOptions options)
    
    type: defang-azure:Postgres
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    resource "defang-azure_postgres" "name" {
        # resource properties
    }

    Parameters

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

    Constructor example

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

    var postgresResource = new DefangAzure.Postgres("postgresResource", new()
    {
        ProjectName = "string",
        Deploy = new DefangAzure.Compose.Inputs.DeployConfigArgs
        {
            Replicas = 0,
            Resources = new DefangAzure.Compose.Inputs.ResourcesArgs
            {
                Reservations = new DefangAzure.Compose.Inputs.ResourceConfigArgs
                {
                    Cpus = 0,
                    Memory = "string",
                },
            },
        },
        Environment = 
        {
            { "string", "string" },
        },
        Image = "string",
        Postgres = new DefangAzure.Compose.Inputs.PostgresConfigArgs
        {
            AllowDowntime = false,
            FromSnapshot = "string",
        },
    });
    
    example, err := defangazure.NewPostgres(ctx, "postgresResource", &defangazure.PostgresArgs{
    	ProjectName: "string",
    	Deploy: &compose.DeployConfigArgs{
    		Replicas: pulumi.Int(0),
    		Resources: &compose.ResourcesArgs{
    			Reservations: &compose.ResourceConfigArgs{
    				Cpus:   pulumi.Float64(0),
    				Memory: pulumi.String("string"),
    			},
    		},
    	},
    	Environment: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    	Image: "string",
    	Postgres: &compose.PostgresConfigArgs{
    		AllowDowntime: pulumi.Bool(false),
    		FromSnapshot:  pulumi.String("string"),
    	},
    })
    
    resource "defang-azure_postgres" "postgresResource" {
      project_name = "string"
      deploy = {
        replicas = 0
        resources = {
          reservations = {
            cpus   = 0
            memory = "string"
          }
        }
      }
      environment = {
        "string" = "string"
      }
      image = "string"
      postgres = {
        allow_downtime = false
        from_snapshot  = "string"
      }
    }
    
    var postgresResource = new Postgres("postgresResource", PostgresArgs.builder()
        .projectName("string")
        .deploy(DeployConfigArgs.builder()
            .replicas(0)
            .resources(ResourcesArgs.builder()
                .reservations(ResourceConfigArgs.builder()
                    .cpus(0.0)
                    .memory("string")
                    .build())
                .build())
            .build())
        .environment(Map.of("string", "string"))
        .image("string")
        .postgres(PostgresConfigArgs.builder()
            .allowDowntime(false)
            .fromSnapshot("string")
            .build())
        .build());
    
    postgres_resource = defang_azure.Postgres("postgresResource",
        project_name="string",
        deploy={
            "replicas": 0,
            "resources": {
                "reservations": {
                    "cpus": float(0),
                    "memory": "string",
                },
            },
        },
        environment={
            "string": "string",
        },
        image="string",
        postgres={
            "allow_downtime": False,
            "from_snapshot": "string",
        })
    
    const postgresResource = new defang_azure.Postgres("postgresResource", {
        projectName: "string",
        deploy: {
            replicas: 0,
            resources: {
                reservations: {
                    cpus: 0,
                    memory: "string",
                },
            },
        },
        environment: {
            string: "string",
        },
        image: "string",
        postgres: {
            allowDowntime: false,
            fromSnapshot: "string",
        },
    });
    
    type: defang-azure:Postgres
    properties:
        deploy:
            replicas: 0
            resources:
                reservations:
                    cpus: 0
                    memory: string
        environment:
            string: string
        image: string
        postgres:
            allowDowntime: false
            fromSnapshot: string
        projectName: string
    

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

    Outputs

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

    Endpoint string
    Endpoint string
    endpoint string
    endpoint String
    endpoint string
    endpoint String

    Supporting Types

    DeployConfig, DeployConfigArgs

    PostgresConfig, PostgresConfigArgs

    ResourceConfig, ResourceConfigArgs

    Cpus double
    Memory string
    Cpus float64
    Memory string
    cpus number
    memory string
    cpus Double
    memory String
    cpus number
    memory string
    cpus float
    memory str
    cpus Number
    memory String

    Resources, ResourcesArgs

    Package Details

    Repository
    defang-azure DefangLabs/pulumi-defang
    License
    Apache-2.0
    defang-azure logo
    Viewing docs for Defang Azure v2.4.1
    published on Saturday, Jul 11, 2026 by Defang

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial