Skip to content

Instantly share code, notes, and snippets.

@ryan-dyer-sp
Created May 5, 2020 20:01
Show Gist options
  • Save ryan-dyer-sp/0b3e46d27c0dd88ab8bcfc7d1801114e to your computer and use it in GitHub Desktop.
Save ryan-dyer-sp/0b3e46d27c0dd88ab8bcfc7d1801114e to your computer and use it in GitHub Desktop.
> terraform plan
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.
data.aws_ssm_parameter.db_admin_pass: Refreshing state...
data.aws_ssm_parameter.db_admin_user: Refreshing state...
data.aws_ssm_parameter.db_host: Refreshing state...
------------------------------------------------------------------------
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# postgresql_database.db will be created
+ resource "postgresql_database" "db" {
+ allow_connections = true
+ connection_limit = -1
+ encoding = (known after apply)
+ id = (known after apply)
+ is_template = (known after apply)
+ lc_collate = "en_US.UTF-8"
+ lc_ctype = "en_US.UTF-8"
+ name = "testinstance-db"
+ owner = "testinstance_admin"
+ tablespace_name = (known after apply)
+ template = (known after apply)
}
# postgresql_role.customer_admin will be created
+ resource "postgresql_role" "customer_admin" {
+ bypass_row_level_security = false
+ connection_limit = -1
+ create_database = false
+ create_role = false
+ encrypted_password = true
+ id = (known after apply)
+ inherit = true
+ login = true
+ name = "testinstance_admin"
+ password = (sensitive value)
+ replication = false
+ skip_drop_role = false
+ skip_reassign_owned = true
+ superuser = false
+ valid_until = "infinity"
}
# random_password.db_pass will be created
+ resource "random_password" "db_pass" {
+ id = (known after apply)
+ length = 12
+ lower = true
+ min_lower = 0
+ min_numeric = 0
+ min_special = 0
+ min_upper = 0
+ number = true
+ override_special = "!#$%&*()-_=+[]{}<>:?"
+ result = (sensitive value)
+ special = true
+ upper = true
}
Plan: 3 to add, 0 to change, 0 to destroy.
------------------------------------------------------------------------
Note: You didn't specify an "-out" parameter to save this plan, so Terraform
can't guarantee that exactly these actions will be performed if
"terraform apply" is subsequently run.
> terraform destroy -auto-approve
data.aws_ssm_parameter.db_admin_pass: Refreshing state...
data.aws_ssm_parameter.db_admin_user: Refreshing state...
data.aws_ssm_parameter.db_host: Refreshing state...
Error: Error initializing PostgreSQL client: error detecting capabilities: error PostgreSQL version: dial tcp :5432: connect: connection refused
on example.tf line 1, in provider "postgresql":
1: provider "postgresql" {
> terraform apply -auto-approve
data.aws_ssm_parameter.db_admin_pass: Refreshing state...
data.aws_ssm_parameter.db_admin_user: Refreshing state...
data.aws_ssm_parameter.db_host: Refreshing state...
random_password.db_pass: Creating...
random_password.db_pass: Creation complete after 0s [id=none]
postgresql_role.customer_admin: Creating...
postgresql_role.customer_admin: Creation complete after 3s [id=testinstance_admin]
postgresql_database.db: Creating...
postgresql_database.db: Still creating... [10s elapsed]
postgresql_database.db: Creation complete after 11s [id=testinstance-db]
Apply complete! Resources: 3 added, 0 changed, 0 destroyed.
> terraform destroy -auto-approve
random_password.db_pass: Refreshing state... [id=none]
data.aws_ssm_parameter.db_admin_user: Refreshing state...
data.aws_ssm_parameter.db_host: Refreshing state...
data.aws_ssm_parameter.db_admin_pass: Refreshing state...
postgresql_role.customer_admin: Refreshing state... [id=testinstance_admin]
postgresql_database.db: Refreshing state... [id=testinstance-db]
postgresql_database.db: Destroying... [id=testinstance-db]
postgresql_database.db: Destruction complete after 6s
postgresql_role.customer_admin: Destroying... [id=testinstance_admin]
postgresql_role.customer_admin: Destruction complete after 1s
random_password.db_pass: Destroying... [id=none]
random_password.db_pass: Destruction complete after 0s
Destroy complete! Resources: 3 destroyed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment