terraform-provider-postgresql
terraform-provider-postgresql copied to clipboard
Added a check during the `postgresql_extension` to prevent multiple resources from being created for the one extension
To address [#304] where users are implementing multiple extension resources per extension under the assumption one is required per schema. According to postgres documentation, schema is only the location to install the extensions objects.
Changes:
- Updated the README to describe running the provider in a local environment
- Added a check during the
postgresql_extension
to prevent multiple resources from being created for the one extension - Updated documentation to deter users from creating the same extension across multiple schemas
resource "postgresql_extension" "schema2" {
name = "pg_stat_statements"
schema = "schema2"
}
resource "postgresql_extension" "schema1" {
name = "pg_stat_statements"
schema = "schema1"
}
Prior: both resources created, each apply
will ALTER
the schema of the extension.
Now: one resource will be created and the other will error eg.
Error: extension 'pg_stat_statements' already exists under schema 'schema1'
Projects which contain multiple resources for the same extension will still experience the same behaviour akin to importing a resource into two places. However, new resources created will be unable to do so if the extension exists. A note in the upgrade docs should mention to terraform state rm
places where extensions have been duplicated