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
34 stars 13 forks source link

As a user, I want to use newly created branch to create a new database #85

Closed kislerdm closed 7 months ago

kislerdm commented 7 months ago

Problem

It's allowed to create a database using a newly created branch without associated endpoint. It shall be forbidden because endpoint is required to communicate with the database.

Proposed solution

Every newly created branch will create an RW endpoint.

kbumsik commented 7 months ago

Hi @kislerdm,

Please reconsider creating an implicit resource as mentioned in my comment.

Making a bundled resources like this is better suited to TF module, not TF resource.

How about just writing a documentation to let users to define explicit dependency like this?:

resource "neon_endpoint" "this" {
  type  = "read_write"
  ...
}

resource "neon_database" "this" {
  ...

+  depends_on = [neon_endpoint.main]
}
kislerdm commented 7 months ago

@kbumsik You are right, simplicity is more appropriate in the provider compared to a module where new branch and endpoint could be abstracted by a single façade.

kbumsik commented 7 months ago

Thank you 👍