{"library":"pulumi-postgresql","title":"Pulumi PostgreSQL","description":"The `pulumi-postgresql` package provides a Pulumi provider for creating and managing PostgreSQL cloud resources. It allows users to define PostgreSQL databases, roles, schemas, and other configurations as infrastructure-as-code using Python and other supported languages. The provider is derived from the Terraform PostgreSQL provider and receives frequent updates, often alongside its upstream dependencies.","language":"python","status":"active","last_verified":"Sun May 17","install":{"commands":["pip install pulumi_postgresql"],"cli":null},"imports":["import pulumi_postgresql as postgresql","from pulumi_postgresql import Database","from pulumi_postgresql import Role"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import pulumi\nimport pulumi_postgresql as postgresql\nimport os\n\n# Configure PostgreSQL provider using environment variables for sensitive data\n# Alternatively, use `pulumi config set postgresql:host <value>` etc.\n# For passwords, use `pulumi config set --secret postgresql:password <value>`\n\npg_host = os.environ.get('PGHOST', 'localhost')\npg_user = os.environ.get('PGUSER', 'postgres')\npg_password = os.environ.get('PGPASSWORD', 'password')\npg_database = os.environ.get('PGDATABASE', 'postgres') # Database for initial connection\npg_port = os.environ.get('PGPORT', '5432')\npg_sslmode = os.environ.get('PGSSLMODE', 'disable') # Often 'disable' for local dev, 'require' for production\n\n# The provider needs to be explicitly configured if not using default environment variables or pulumi config.\n# For this example, we're relying on environment variables or `pulumi config`.\n# If you need to explicitly create a provider instance:\n# pg_provider = postgresql.Provider(\"pg-provider\",\n#     host=pg_host,\n#     username=pg_user,\n#     password=pg_password,\n#     database=pg_database,\n#     port=pg_port,\n#     sslmode=pg_sslmode\n# )\n\n# Create a new PostgreSQL database\nnew_db = postgresql.Database(\"my-new-database\",\n    name=\"mydatabase\",\n    opts=pulumi.ResourceOptions(delete_before_replace=True) # Optional: ensures clean replacement if name changes\n)\n\n# Create a new PostgreSQL role (user)\nnew_role = postgresql.Role(\"my-app-role\",\n    name=\"app_user\",\n    login=True,\n    password=\"strong_password_here\", # In production, this should be a secret!\n    opts=pulumi.ResourceOptions(delete_before_replace=True) # Optional\n)\n\n# Export the database name and role name\npulumi.export('database_name', new_db.name)\npulumi.export('role_name', new_role.name)\n","lang":"python","description":"This quickstart demonstrates how to create a new PostgreSQL database and a new role (user) using the `pulumi-postgresql` provider. It assumes PostgreSQL connection details are configured via environment variables (`PGHOST`, `PGUSER`, `PGPASSWORD`, `PGDATABASE`, `PGPORT`, `PGSSLMODE`) or Pulumi configuration. For local development, `PGSSLMODE` is often set to `disable` to avoid SSL connection errors. Always manage sensitive data like passwords using Pulumi secrets.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-17","installed_version":"3.16.3","pypi_latest":"3.16.3","is_stale":false,"summary":{"python_range":"3.10–3.9","success_rate":100,"avg_install_s":6.6,"avg_import_s":1.44,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"pulumi_postgresql","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"noisy","install_time_s":null,"import_time_s":1.51,"mem_mb":24.6,"disk_size":"88.5M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"pulumi_postgresql","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"noisy","install_time_s":7.2,"import_time_s":0.73,"mem_mb":19.6,"disk_size":"74M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"pulumi_postgresql","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"noisy","install_time_s":null,"import_time_s":2.1,"mem_mb":27.2,"disk_size":"95.0M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"pulumi_postgresql","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"noisy","install_time_s":6.4,"import_time_s":1.21,"mem_mb":22.1,"disk_size":"81M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"pulumi_postgresql","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"noisy","install_time_s":null,"import_time_s":2.2,"mem_mb":26.3,"disk_size":"86.0M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"pulumi_postgresql","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"noisy","install_time_s":5.4,"import_time_s":1.42,"mem_mb":21.3,"disk_size":"75M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"pulumi_postgresql","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"noisy","install_time_s":null,"import_time_s":1.98,"mem_mb":27.4,"disk_size":"85.7M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"pulumi_postgresql","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"noisy","install_time_s":5.7,"import_time_s":1.39,"mem_mb":22.3,"disk_size":"75M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"pulumi_postgresql","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"noisy","install_time_s":null,"import_time_s":1.17,"mem_mb":21.5,"disk_size":"77.7M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"pulumi_postgresql","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"noisy","install_time_s":8.2,"import_time_s":0.67,"mem_mb":16.7,"disk_size":"63M"}]}}