Issues with Course 1 - Module 4 Lab

Description:
I started my lab for Course #1 - Module 4. Everything was going well until I had a connection timeout on my side. The lab environment had a dialog “Trying to reconnect” and it would never reconnect so I rebooted the lab.

Unfortunately I was rebooting while the vector database was being set up. Looking at the AWS console, it seems to have been set up properly but I have no way to connect to it from the terminal now because the command to get the password errors out. The one that gets the user name works well:

coder@99c59ee56546:~/project/terraform$ terraform output vector_db_master_username
"postgres"
coder@99c59ee56546:~/project/terraform$ terraform output vector_db_master_password
╷
│ Error: Output "vector_db_master_password" not found
│ 
│ The output variable requested could not be found in the state file. If you recently added this to your configuration, be sure to run
│ `terraform apply`, since the state won't be updated with new output variables until that command is run.
╵

I keep trying to run terraform apply but it fails no matter what I try to do. The terraform plan shows that all the etl_glue resources and vector_db resources need to be applied but as soon as I try to apply everything it fails saying that the glue resources already exist.

terraform plan:
Plan: 12 to add, 0 to change, 0 to destroy.

terraform apply:

module.etl.aws_glue_connection.rds_connection: Creating...
module.etl.aws_iam_role.glue_role: Creating...
module.etl.aws_glue_catalog_database.ml_database: Creating...
╷
│ Error: creating Glue Catalog Database (de-c1w4-ml-db): operation error Glue: CreateDatabase, https response error StatusCode: 400, RequestID: 206b0af4-19c5-49e1-843d-cdc42417f0cb, AlreadyExistsException: Database already exists.
│ 
│   with module.etl.aws_glue_catalog_database.ml_database,
│   on modules/etl/glue.tf line 1, in resource "aws_glue_catalog_database" "ml_database":
│    1: resource "aws_glue_catalog_database" "ml_database" {
│

I can’t seem to be able to target the vector_db resources only either! I try to use the -target option and it still selects a lot of resources from glue_etl module for some reason.

Hi,

Have you tried rebooting the lab or getting the latest version of the lab files?

You can refer to this post for a step-by-step guide.