list-deployments and deployment-report take an optional --regex parameter to specify the regular expression used to extract the deployment name. For example, if state files are stored in the format bucket/deployment-name/terraform.tfstate, the regular expression '.*\/(.*)\/terraform.tfstate' could be specified to extract the deployment name. Or the regular expression '(.*)' could be specified to view all state files as their own deployment.

Assumptions

Terraform state files are configured for remote state storage in S3 using DynamoDB for locks. Follow the instructions in the deployment documentation for proper setup.

State files keys are in the format: .*/data-persistence.*/terraform.tfstate or .*/cumulus.*/terraform.tfstate or an extraction regex is specified for the list-deployments and deployment-report commands.

Errors

Error extracting deployment name from file ...

An Error extracting deployment name will be printed to the console if a Terraform state file is detected that does not match the specified deployment regular expression, or the default regular expression if none is specified.

Error reading <filename>: The specified key does not exist.

This indicates that there is a Terraform state entry in your DynamoDB locks table pointing to a state file that does not exist. terraform destroy empties your state file of resources, but does not remove the file from S3 nor the entry from DynamoDB. It's possible that the state file was manually deleted, but not the DynamoDB entry.