terraform-provider-postgresql
terraform-provider-postgresql copied to clipboard
Schema Throws An Error If Exists
I'm having an issue trying to apply policies to a schema (public) which already exists (obviously) and even with if_not_exists
in my config, it still throws an error.
Terraform Version
Terraform v0.11.3
+ provider.archive v1.0.0
+ provider.aws v1.10.0
+ provider.postgresql v0.1.1
+ provider.template v1.0.0
Affected Resource(s)
- schema
Terraform Configuration Files
"resource": {
"postgresql_schema": {
"public_schema": {
"count": "${var.database_database_apply ? 1 : 0}",
"depends_on": [
"module.database_server"
],
"name": "public",
"if_not_exists": true,
"policy": [
{
"role": "${var.database_users_application_username}",
"create": false,
"create_with_grant": false,
"usage": true,
"usage_with_grant": false
},
{
"role": "${var.database_users_platform_username}",
"create": true,
"create_with_grant": false,
"usage": true,
"usage_with_grant": false
}
]
},
}
}
}
Debug Output
2018-03-05T02:32:32.792-0600 [DEBUG] plugin: starting plugin: path=/Users/thegranddesign/Projects/myproject/devops/infrastructure/.terraform/plugins/darwin_amd64/terraform-provider-postgresql_v0.1.1_x4 args=[/Users/thegranddesign/Projects/myproject/devops/infrastructure/.terraform/plugins/darwin_amd64/terraform-provider-postgresql_v0.1.1_x4]
2018-03-05T02:32:32.798-0600 [DEBUG] plugin: waiting for RPC address: path=/Users/thegranddesign/Projects/myproject/devops/infrastructure/.terraform/plugins/darwin_amd64/terraform-provider-postgresql_v0.1.1_x4
2018-03-05T02:32:32.804-0600 [DEBUG] plugin.terraform-provider-postgresql_v0.1.1_x4: 2018/03/05 02:32:32 [DEBUG] plugin: plugin address: unix /var/folders/_v/ctqt9rkj3mbd28tmkffbwpg80000gn/T/plugin364488024
2018-03-05T02:32:32.807-0600 [DEBUG] plugin.terraform-provider-postgresql_v0.1.1_x4: 2018/03/05 02:32:32 [INFO] PostgreSQL DSN: `host=myproject.cau3cnzgcojf.us-east-1.rds.amazonaws.com port=7133 dbname=postgres user=<redacted> password=<redacted> sslmode=require connect_timeout=15 fallback_application_name='Terraform v0.10.0-dev'`
2018/03/05 02:32:33 [DEBUG] apply: postgresql_schema.public_schema: executing Apply
postgresql_schema.public_schema: Creating...
if_not_exists: "" => "true"
name: "" => "public"
owner: "" => "<computed>"
policy.#: "0" => "2"
policy.117001700.create: "" => "false"
policy.117001700.create_with_grant: "" => "false"
policy.117001700.role: "" => "btdqvxsgpxpydela"
policy.117001700.usage: "" => "true"
policy.117001700.usage_with_grant: "" => "false"
policy.1832211001.create: "" => "true"
policy.1832211001.create_with_grant: "" => "false"
policy.1832211001.role: "" => "qmjqrfnvyrgbxznk"
policy.1832211001.usage: "" => "true"
policy.1832211001.usage_with_grant: "" => "false"
2018/03/05 02:32:33 [ERROR] root: eval: *terraform.EvalApplyPost, err: 1 error(s) occurred:
* postgresql_schema.public_schema: Error creating schema public: pq: schema "public" already exists
2018/03/05 02:32:33 [ERROR] root: eval: *terraform.EvalSequence, err: 1 error(s) occurred:
* postgresql_schema.public_schema: Error creating schema public: pq: schema "public" already exists
Someone find a workaround of this problem?