Karthik
Karthik

Reputation: 349

Terraform destroy throws errors

I'm able to create and execute my main.tf file without any errors

terraform workspace select dev
terraform plan -var-file=dev.tfvars -out=devplan.out
terraform apply "devplan.out"

But when I try to destroy, I get a bunch of errors as below.

terraform destroy

Error: aws_db_parameter_group.oracle_pg: first character of "name" must be a letter

Error: aws_db_parameter_group.oracle_pg: only lowercase alphanumeric characters and hyphens allowed in "name"

Error: aws_security_group.database-sg: "ingress.0.cidr_blocks.0" must contain a valid CIDR, got error parsing: invalid CIDR address:

Error: aws_security_group.oracle_sg: "ingress.0.cidr_blocks.0" must contain a valid CIDR, got error parsing: invalid CIDR address:

Error: aws_security_group.private-sg: "ingress.0.cidr_blocks.0" must contain a valid CIDR, got error parsing: invalid CIDR address:

Error: aws_vpc.vpcname: "cidr_block" must contain a valid CIDR, got error parsing: invalid CIDR address:

Error: module.db_instance.aws_db_instance.this: first character of "identifier" must be a letter

Error: module.db_instance.aws_db_instance.this: only alphanumeric characters and hyphens allowed in "final_snapshot_identifier"

Error: module.db_instance.aws_db_instance.this: only lowercase alphanumeric characters and hyphens allowed in "identifier"

Upvotes: 0

Views: 610

Answers (1)

BMW
BMW

Reputation: 45223

When you run terraform plan, you know to add --var-file options, then you should feed the same to terraform destroy

terraform destroy -var-file=dev.tfvars

Otherwise, destroy doesn't know your environment.

Upvotes: 2

Related Questions