cyrilgdn / terraform-provider-postgresql

Terraform PostgreSQL provider
https://www.terraform.io/docs/providers/postgresql/
Mozilla Public License 2.0
355 stars 180 forks source link

Provider does not handle arguments of type array in functions correctly #417

Open VasileiosGi opened 3 months ago

VasileiosGi commented 3 months ago

Hi there,

Terraform Version

1.5.7

Affected Resource(s)

postgresql_function

Description

When creating a resource of type postgresql_function if there is an argument of type array with several values as default the resource is correctly applied but in state only the first value exists. For example given an arg with:

default = "ARRAY['sth'::text , 'sth_else'::text]"
type     = "character varying[]"

the resource is correctly applied but in state it is registered as

default = "ARRAY['sth'::text"

Expected Behavior

What should have happened?

default = "ARRAY['sth'::text , 'sth_else'::text]"

Actual Behavior

What actually happened?

default = "ARRAY['sth'::text"

This must be related with this line of code.

kirkiris commented 3 months ago

If the ARRAY has only 1 element, plan/apply goes through as expected and there's no drift reported afterwards