terraform-provider-postgresql icon indicating copy to clipboard operation
terraform-provider-postgresql copied to clipboard

Parsing error when statement_output is manually set to non 0

Open andyyaldoo opened this issue 4 years ago • 1 comments

Terraform Version

❯ t version
Terraform v1.0.11
on darwin_arm64
+ provider registry.terraform.io/cyrilgdn/postgresql v1.14.0

Affected Resource(s)

  • postgresql_role

Terraform Configuration Files

resource "postgresql_role" "this" {
  name                = var.user
  login               = true
  password            = uuid()
  roles               = var.roles
  connection_limit    = var.connection_limit
  skip_reassign_owned = true

  lifecycle {
    ignore_changes = [password]
  }
}

Expected Behavior

Able to parse the statement_timeout to milliseconds

Actual Behavior

What actually happened?

╷
│ Error: Error reading statement_timeout: strconv.Atoi: parsing "12s": invalid syntax
│
│   with module.postgresql_database_setup.postgresql_role.app[0],
│   on ../../../../modules/postgresql/database_setup/main.tf line 61, in resource "postgresql_role" "app":
│   61: resource "postgresql_role" "app" {
│
╵

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. Add the role via terraform
  2. Manually edit the statement timeout so that the output of rolconfig is like below:
postgres=> SELECT rolconfig FROM pg_catalog.pg_roles WHERE rolname='therole';
                                rolconfig
-------------------------------------------------------------------------
 {statement_timeout=12s,vacuum_cost_limit=2000,maintenance_work_mem=1GB}
(1 row)
  1. terraform plan

andyyaldoo avatar Nov 22 '21 10:11 andyyaldoo

I was able to avoid this issue by setting statement_timeout without units (in milliseconds)

Anton-Shutik avatar Mar 21 '23 15:03 Anton-Shutik