Skip to content
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

Importing aiven_pg_user forces recreation after fork and restore #2065

Open
awesomund opened this issue Feb 24, 2025 · 0 comments
Open

Importing aiven_pg_user forces recreation after fork and restore #2065

awesomund opened this issue Feb 24, 2025 · 0 comments

Comments

@awesomund
Copy link

awesomund commented Feb 24, 2025

What happened?

I created a new database service using the aiven_pg resource and the pg_service_to_fork_from-property.

After creating the service, I wanted to import all databases, connection pools and users into my IaC/terraform-state. Importing databases and connection pools worked as expected, but after importing users I got a diff when running terraform plan (names have been changed):

terraform: -/+ destroy and then create replacement
14:54:17.306 STDOUT terraform: Terraform will perform the following actions:
14:54:17.306 STDOUT terraform:   # aiven_pg_user.foo["my-server_my-user"] must be replaced
14:54:17.306 STDOUT terraform: -/+ resource "aiven_pg_user" "foo" {
14:54:17.306 STDOUT terraform:       + access_cert          = (sensitive value)
14:54:17.306 STDOUT terraform:       + access_key           = (sensitive value)
14:54:17.306 STDOUT terraform:       ~ id                   = "my-project/my-service/my-user -> (known after apply)
14:54:17.307 STDOUT terraform:       ~ password             = (sensitive value)
14:54:17.307 STDOUT terraform:       - pg_allow_replication = false -> null
14:54:17.307 STDOUT terraform:       + project              = "my-project" # forces replacement
14:54:17.307 STDOUT terraform:       + service_name         = "my-service" # forces replacement
14:54:17.307 STDOUT terraform:       ~ type                 = "normal" -> (known after apply)
14:54:17.307 STDOUT terraform:         # (1 unchanged attribute hidden)
14:54:17.307 STDOUT terraform:     }
14:54:17.307 STDOUT terraform: Plan: 1 to add, 0 to change, 1 to destroy.

Just to be sure, I also tested this with clickopsing (using the "fork & restore"-feature), with the same result.

As you can see from the diff, it seems like the project and service_name properties are not included in the imported resource, forcing replacement.

What did you expect to happen?

No diff after import. At least the required properties for aiven_pg_user, like the ones missing here, should be present.

What else do we need to know?

Terraform v1.10.5
on darwin_arm64

  • provider registry.terraform.io/aiven/aiven v4.36.0
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

No branches or pull requests

1 participant