Open yurhasko opened 1 day ago
@yurhasko hello! Thanks for raising the issue. Could you please describe how the describe the exact steps followed to import the resource. Also, did I get it right: an attempt to import the default endpoint has been made, correct? Could you please share the use case: what is the rationale behind importing the default project endpoint? What are you trying to achieve? Thanks!
The reason to import the default project endpoint was to adjust its settings (enable autoscaling with min and max CUs). I tried to enable autoscaling via dynamic block at the project resource, but it doesn't change anything for existing branches and their compute endpoints. Here's my Terraform config:
resource "project_resource" "project" {
name = var.project_name
enable_logical_replication = "yes"
org_id = var.organization_id
pg_version = "16"
history_retention_seconds = var.history_retention_seconds
dynamic "endpoint_settings" {
for_each = var.autoscaling_enabled ? [1] : []
content {
autoscaling_limit_min_cu = var.autoscaling_limit_min_cu
autoscaling_limit_max_cu = var.autoscaling_limit_max_cu
suspend_timeout_seconds = var.suspend_timeout_seconds
}
}
}
resource "role_resource" "role" {
project_id = project_resource.project.id
name = "role_name"
branch_id = project_resource.project.default_branch_id
}
resource "database_resource" "database" {
project_id = project_resource.project.id
branch_id = project_resource.project.default_branch_id
name = var.database_name
owner_name = role_resource.role.name
}
resource "endpoint_resource" "main_endpoint" {
project_id = project_resource.project.id
branch_id = project_resource.project.default_branch_id
type = "read_write"
autoscaling_limit_min_cu = var.autoscaling_limit_min_cu
autoscaling_limit_max_cu = var.autoscaling_limit_max_cu
suspend_timeout_seconds = var.suspend_timeout_seconds
}
@yurhasko I see, thanks for sharing details. Please do not import the default resources provisioned with the project for their further modification. It leads to inconsistent terraform state and ultimately defeats the purpose of IaC.
Regarding your use case, did I get it right: the intent was, to modify the autoscaling limits of already provisioned default endpoint, right?
Have you tried configuring the endpoint compute limits without using the "dynamic" block?
Also, please share the manifest you used to provision the env. You only shared the module; how was it configured, what variable values have been used?
Thanks!
Hi there
Import for
neon_endpoint
doesn't work neither asterraform import
via CLI, nor usingimport
block (both were done as described in https://registry.terraform.io/providers/kislerdm/neon/latest/docs/resources/endpoint#import)Versions
terraform v1.6.3 terragrunt v0.50.14 provider v0.6.3
Affected resources
neon_endpoint
Output with
TF_LOG=TRACE