kislerdm / terraform-provider-neon

Terraform provider to manage Neon SaaS resources
https://registry.terraform.io/providers/kislerdm/neon/latest/docs
Mozilla Public License 2.0
35 stars 13 forks source link

Primary branch config is ignored #42

Closed domenikk closed 1 year ago

domenikk commented 1 year ago

Terraform Version

Terraform v1.5.6
on darwin_arm64
+ provider registry.terraform.io/kislerdm/neon v0.2.1

Provider Version

0.2.1

Affected Resource(s)

Terraform Configuration Files

terraform {
  required_providers {
    neon = {
      source  = "kislerdm/neon"
      version = "0.2.1"
    }
  }
}

provider "neon" {}

resource "neon_project" "this" {
  name      = var.project_name
  region_id = var.region

  branch {
    name = "master"
    database_name = "neon-test"
    role_name = "admin"
  }
}

Debug Output

https://gist.github.com/domenikk/7eae89c13154375f721a800c00e6e363

Panic Output

If Terraform produced a panic, please provide a link to a GitHub Gist containing the output of the crash.log.

Expected Behavior

Primary branch should have been created using the values (name, database_name, role_name) provided in config.

Actual Behavior

Branch has been created with the default values from Neon, ignoring config. From .tfstate file:

"branch": [
  {
    "database_name": "neondb",
    "id": "br-frosty-cherry-96448510",
    "name": "main",
    "role_name": "neon.user"
  }
]

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply

Important Factoids

Are there anything atypical about your accounts that we should know?

References

Are there any other GitHub issues (open or closed) or Pull Requests that should be linked here? For example:

domenikk commented 1 year ago

@kislerdm This line stood out after a quick review of the relevant code: https://github.com/kislerdm/terraform-provider-neon/blob/e93ab5c15bbbb052b4b7f969cd8c69290c48d1bc/internal/provider/resource_project.go#L330-L332 (RoleName instead of DatabaseName). Not sure if it explains why branch name and role_name are ignored as well.

kislerdm commented 1 year ago

@domenikk Hello! Thank you for opening the issue!

AFAIK, the default branch cannot be mutated upon project creation. I'll check with Neon folks, and come back with execution paths for us to align on if you don't mind. Thanks for your support!

Regards, Dmitry

kislerdm commented 1 year ago

@domenikk hey! A headsup: the issue's root cause was identified, it will be fixed in v0.2.2. ETA: 2023-09-20.

domenikk commented 1 year ago

@kislerdm that's great news. Thanks a lot for looking into it

kislerdm commented 1 year ago

@domenikk Hey! Thank you for your contribution! May I kindly ask to star the repo to gain its visibility? Thanks!