terraform-provider-upcloud
terraform-provider-upcloud copied to clipboard
upcloud_managed_database_postgresql complains about properties
provider: upcloudltd/upcloud v5.1.1
terraform apply/refresh/plan produces:
│ Error: Invalid address to set: []string{"properties", "0", "pg_read_replica"}
│
│ with upcloud_managed_database_postgresql.db,
│ on main.tf line 30, in resource "upcloud_managed_database_postgresql" "db":
│ 30: resource "upcloud_managed_database_postgresql" "db" {
terraform in question:
resource "upcloud_managed_database_postgresql" "db" {
name = "gateway-db-${var.env}"
plan = var.db_plan
title = "gateway-db-${var.env}"
zone = data.terraform_remote_state.network.outputs.zone
properties {
admin_username = var.worker_db_username
admin_password = random_password.worker_db_password.result
ip_filter = data.terraform_remote_state.network.outputs.database_ip_filter
}
}
https://github.com/UpCloudLtd/terraform-provider-upcloud/blob/1e5ad9aae496b21d1236c63bf8e84cc9420c46c6/CHANGELOG.md?plain=1#L90 lists pg_read_replica as removed, but if I do terraform state show upcloud_managed_database_postgresql.db | grep replica
, it will only list:
max_logical_replication_workers = 0
max_replication_slots = 0
max_failover_replication_time_lag = 60
So nothing about pg_read_replica
.
Also validated that terraform state pull | grep replica
produces:
"max_logical_replication_workers": 0,
"max_replication_slots": 0,
"max_failover_replication_time_lag": 60
"synchronous_replication": "",
"allow_replication": false
Downgrade to 5.1.0 seems to resolve this issue.
Hello, thanks for the bug report! Could you check if there is anything about pg_read_replica
in your terraform.tfstate
file(s)?
We are using postgresql as terraform backend, but terraform state pull
should send us raw tfstate content.
But I can still execute terraform plan/apply/refresh
just fine with terraform provider 5.1.0 and everything breaks with 5.1.1
If I give terraform state show upcloud_managed_database_postgresql.db
with 5.1.0, it looks like this:
# upcloud_managed_database_postgresql.db:
resource "upcloud_managed_database_postgresql" "db" {
components = [
{
component = "pg"
host = "REDACTED"
port = 11550
route = "dynamic"
usage = "primary"
},
{
component = "pgbouncer"
host = "REDACTED"
port = 11551
route = "dynamic"
usage = "primary"
},
]
id = "096a683b-155d-4a62-9c01-bd3136424403"
maintenance_window_dow = "sunday"
maintenance_window_time = "05:00:00"
name = "REDACTED"
node_states = [
{
name = "REDACTED"
role = "master"
state = "running"
},
]
plan = "1x1xCPU-2GB-25GB"
powered = true
primary_database = "defaultdb"
service_host = "REDACTED"
service_password = (sensitive value)
service_port = "11550"
service_uri = (sensitive value)
service_username = "worker"
state = "running"
title = "REDACTED"
zone = "fi-hel2"
properties {
automatic_utility_network_ip_filter = true
autovacuum_analyze_scale_factor = 0
autovacuum_analyze_threshold = 0
autovacuum_freeze_max_age = 0
autovacuum_max_workers = 0
autovacuum_naptime = 0
autovacuum_vacuum_cost_delay = 0
autovacuum_vacuum_cost_limit = 0
autovacuum_vacuum_scale_factor = 0
autovacuum_vacuum_threshold = 0
backup_hour = 0
backup_minute = 32
bgwriter_delay = 0
bgwriter_flush_after = 0
bgwriter_lru_maxpages = 0
bgwriter_lru_multiplier = 0
deadlock_timeout = 0
idle_in_transaction_session_timeout = 0
ip_filter = [
"REDACTED",
]
jit = false
log_autovacuum_min_duration = 0
log_min_duration_statement = 0
log_temp_files = 0
max_files_per_process = 0
max_locks_per_transaction = 0
max_logical_replication_workers = 0
max_parallel_workers = 0
max_parallel_workers_per_gather = 0
max_pred_locks_per_transaction = 0
max_prepared_transactions = 0
max_replication_slots = 0
max_slot_wal_keep_size = 0
max_stack_depth = 0
max_standby_archive_delay = 0
max_standby_streaming_delay = 0
max_wal_senders = 0
max_worker_processes = 0
pg_partman_bgw_interval = 0
pg_stat_monitor_enable = false
pg_stat_monitor_pgsm_enable_query_plan = false
pg_stat_monitor_pgsm_max_buckets = 0
public_access = false
service_log = false
shared_buffers_percentage = 0
temp_file_limit = 0
track_activity_query_size = 0
version = "15"
wal_sender_timeout = 0
wal_writer_delay = 0
work_mem = 0
pglookout {
max_failover_replication_time_lag = 60
}
}
}
A patch release v5.2.1 for this bug has just been released.
We are happy to help out if any following issues occur.
Closing this for now, please come back if there are further issues.