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

Missing Attributes from Import of avien_pg Resource #1820

Open
briankahoot opened this issue Aug 29, 2024 · 0 comments · May be fixed by #1846
Open

Missing Attributes from Import of avien_pg Resource #1820

briankahoot opened this issue Aug 29, 2024 · 0 comments · May be fixed by #1846
Labels
bug Something isn't working

Comments

@briankahoot
Copy link

What happened?

We have an existing database service that has two read replicas. We are trying to import this service into terraform so that it can be managed from there from now on. The terraform definition of the replicas looks like the following.

resource "aiven_pg" "db_read_replica" {
  project                 = var.aiven_project
  cloud_name              = var.cloud_name
  service_name            = "${local.base_database_name}-replica"
  plan                    = var.replica_plan
  maintenance_window_dow  = "sunday"
  maintenance_window_time = "10:00:00"
  termination_protection  = true
  additional_disk_space   = var.additional_disk_space

  service_integrations {
    integration_type    = "read_replica"
    source_service_name = aiven_pg.stats_db.service_name
  }

  pg_user_config {
    service_to_fork_from = aiven_pg.stats_db.service_name
  }
}

While the report is successful attempting to do a plan afterwards leads to two separate issues. First the additional_disk_space attribute is not imported so that even though the existing database has addition storage it shows as an addition.

Second, and more problematic, is that the service_integration block causes the plan to fail with the following error. It appears that this data has not been imported and the provider thinks it needs to apply the integration as a change, which it can't do as it needs to be specified at service creation apparently.

│ Error: service_integrations field can only be set during creation of a service
│ 
│   with aiven_pg.db_read_replica,
│   on [replica.tf](http://replica.tf/) line 1, in resource "aiven_pg" "db_read_replica":
│    1: resource "aiven_pg" "stats_db_read_replica" {
│ 

Currently I have solved this by editing the state directly.

What did you expect to happen?

I expect the properties of the database and service integrations to be added to the state as part of the import so that subsequent plans work and reflect the current state of the system.

@byashimov byashimov added the bug Something isn't working label Sep 3, 2024
rriski added a commit that referenced this issue Sep 17, 2024
rriski added a commit that referenced this issue Sep 18, 2024
rriski added a commit that referenced this issue Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants