Skip to content

docs: update terraform provider, add opentofu guide #3503

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

dhanushreddy291
Copy link
Contributor

@dhanushreddy291 dhanushreddy291 commented May 22, 2025

Copy link

vercel bot commented May 22, 2025

@dhanushreddy291 is attempting to deploy a commit to the neondatabase Team on Vercel.

A member of the Team first needs to authorize it.

@dhanushreddy291 dhanushreddy291 force-pushed the update-docs/terraform-provider branch from 2913f01 to 2c14d96 Compare May 22, 2025 18:00
Copy link

vercel bot commented May 22, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
neon-next ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 26, 2025 11:33am

The plan might show:

- **Attributes to be added to your HCL:** Terraform will identify attributes present in the imported state (e.g., `pg_version`, `region_id`, `default_endpoint_settings` for a project) that are not yet explicitly in your HCL `resource` blocks.
- **"Update in-place" actions:** You might see actions like `~ update in-place` for some resources, even if no actual value in Neon is changing. For example, for `neon_endpoint`, you might see `+ branch_id = "your-branch-id"`. This is often because Terraform is now resolving a reference (like `neon_branch.dev_branch.id`) to its concrete value and wants to explicitly set this in its managed configuration. It's a reconciliation step and usually safe to apply.
Copy link
Contributor Author

@dhanushreddy291 dhanushreddy291 May 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@danieltprice just wanted to get this line reviewed from any Devops/Terraform person at Neon

Using either import method says in-place update of branch_id under endpoint
Method 1 output:
image

Method 2 output:

terraform plan
neon_project.my_app_project: Preparing import... [id=silent-smoke-79035518]
neon_project.my_app_project: Refreshing state... [id=silent-smoke-79035518]
neon_branch.dev_branch: Preparing import... [id=br-billowing-river-a5ja746p]
neon_branch.dev_branch: Refreshing state... [id=br-billowing-river-a5ja746p]
neon_endpoint.dev_endpoint: Preparing import... [id=ep-solitary-fire-a5s46nqm]
neon_role.app_user: Preparing import... [id=silent-smoke-79035518/br-billowing-river-a5ja746p/application_user]
neon_role.app_user: Refreshing state... [id=silent-smoke-79035518/br-billowing-river-a5ja746p/application_user]
neon_endpoint.dev_endpoint: Refreshing state... [id=ep-solitary-fire-a5s46nqm]
neon_database.service_db: Preparing import... [id=silent-smoke-79035518/br-billowing-river-a5ja746p/service_specific_database]
neon_database.service_db: Refreshing state... [id=silent-smoke-79035518/br-billowing-river-a5ja746p/service_specific_database]

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the
following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # neon_branch.dev_branch will be imported
    resource "neon_branch" "dev_branch" {
        id               = "br-billowing-river-a5ja746p"
        logical_size     = 38395904
        name             = "feature-x-development"
        parent_id        = "br-lucky-dream-a5se8evr"
        parent_lsn       = "0/1F79210"
        parent_timestamp = 1748237689
        project_id       = "silent-smoke-79035518"
    }

  # neon_database.service_db will be imported
    resource "neon_database" "service_db" {
        branch_id  = "br-billowing-river-a5ja746p"
        id         = "silent-smoke-79035518/br-billowing-river-a5ja746p/service_specific_database"
        name       = "service_specific_database"
        owner_name = "application_user"
        project_id = "silent-smoke-79035518"
    }

  # neon_endpoint.dev_endpoint will be updated in-place
  # (imported from "ep-solitary-fire-a5s46nqm")
  ~ resource "neon_endpoint" "dev_endpoint" {
        autoscaling_limit_max_cu = 0.5
        autoscaling_limit_min_cu = 0.25
      + branch_id                = "br-billowing-river-a5ja746p"
        compute_provisioner      = "k8s-neonvm"
        disabled                 = false
        host                     = "ep-solitary-fire-a5s46nqm.us-east-2.aws.neon.tech"
        id                       = "ep-solitary-fire-a5s46nqm"
        pooler_enabled           = false
        pooler_mode              = "transaction"
        project_id               = "silent-smoke-79035518"
        proxy_host               = "us-east-2.aws.neon.tech"
        region_id                = "aws-us-east-2"
        suspend_timeout_seconds  = 0
        type                     = "read_write"
    }

  # neon_project.my_app_project will be imported
    resource "neon_project" "my_app_project" {
        allowed_ips               = []
        compute_provisioner       = "k8s-neonvm"
        connection_uri            = (sensitive value)
        connection_uri_pooler     = (sensitive value)
        database_host             = "ep-tight-frost-a5a5ghph.us-east-2.aws.neon.tech"
        database_host_pooler      = "ep-tight-frost-a5a5ghph-pooler.us-east-2.aws.neon.tech"
        database_name             = "app_db"
        database_password         = (sensitive value)
        database_user             = "app_admin"
        default_branch_id         = "br-lucky-dream-a5se8evr"
        default_endpoint_id       = "ep-tight-frost-a5a5ghph"
        history_retention_seconds = 86400
        id                        = "silent-smoke-79035518"
        name                      = "my-application-project"
        pg_version                = 16
        region_id                 = "aws-us-east-2"
        store_password            = "yes"

        branch {
            database_name = "app_db"
            id            = "br-lucky-dream-a5se8evr"
            name          = "production"
            role_name     = "app_admin"
        }

        default_endpoint_settings {
            autoscaling_limit_max_cu = 1
            autoscaling_limit_min_cu = 0.25
            id                       = "ep-tight-frost-a5a5ghph"
            suspend_timeout_seconds  = 0
        }

        quota {}
    }

  # neon_role.app_user will be imported
    resource "neon_role" "app_user" {
        branch_id  = "br-billowing-river-a5ja746p"
        id         = "silent-smoke-79035518/br-billowing-river-a5ja746p/application_user"
        name       = "application_user"
        password   = (sensitive value)
        project_id = "silent-smoke-79035518"
        protected  = false
    }

Plan: 5 to import, 0 to add, 1 to change, 0 to destroy.

I assume its reconciling the branch_id to a static value and is fine

@dhanushreddy291 dhanushreddy291 changed the title docs: update terraform provider [WIP] docs: update terraform provider May 26, 2025
@dhanushreddy291 dhanushreddy291 force-pushed the update-docs/terraform-provider branch from fb038f5 to 87bcabf Compare May 26, 2025 11:09
@dhanushreddy291 dhanushreddy291 changed the title [WIP] docs: update terraform provider docs: update terraform provider, add opentofu guide May 26, 2025
@dhanushreddy291 dhanushreddy291 marked this pull request as ready for review May 26, 2025 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant