Hey, guys! Urgent question. AWS still charges mon...
# ask-metaflow
b
Hey, guys! Urgent question. AWS still charges money from my account. I used
terraform init
previously.
terraform destroy
produces me something like
Copy code
denis@denis-TM1703:~/PycharmProjects/terraform-aws-metaflow$ terraform destroy
╷
│ Error: Module not installed
│ 
│   on <http://locals.tf|locals.tf> line 1:
│    1: module "metaflow-common" {
│ 
│ This module is not yet installed. Run "terraform init" to install all modules
│ required by this configuration.
╵
╷
│ Error: Module not installed
│ 
│   on <http://main.tf|main.tf> line 1:
│    1: module "metaflow-datastore" {
│ 
│ This module is not yet installed. Run "terraform init" to install all modules
Is it possible to delete everything manually in aws? Like force deleting. I tried my best, but I got in VPC and EC2 that "delete is not allowed". Thank you so much.
b
Did
terraform init
produce an error? I'd expect
terraform init
followed by
terraform destroy
to do what you want.
b
It asks me the following after `terraform destroy`:
Copy code
Interrupt received.
Please wait for Terraform to exit or data loss may occur.
Gracefully shutting down...

╷
│ Error: No value for required variable
│ 
│   on variables.tf line 123:
│  123: variable "tags" {
│ 
│ The root module input variable "tags" is not set, and has no default value. Use a -var or -var-file command line argument to provide a value for this variable.
╵
╷
│ Error: No value for required variable
│ 
│   on variables.tf line 146:
│  146: variable "vpc_cidr_blocks" {
│ 
│ The root module input variable "vpc_cidr_blocks" is not set, and has no default value. Use a -var or -var-file command line argument to provide a value for this variable.
╵
╷
│ Error: No value for required variable
│ 
│   on variables.tf line 151:
│  151: variable "vpc_id" {
│ 
│ The root module input variable "vpc_id" is not set, and has no default value. Use a -var or -var-file command line argument to provide a value for this variable.
╵
╷
│ Error: No value for required variable
│ 
│   on variables.tf line 180:
│  180: variable "with_public_ip" {
│ 
│ The root module input variable "with_public_ip" is not set, and has no default value. Use a -var or -var-file command line argument to provide a value for this variable.
But I don't quite understand, how to use, for instance,
-var -var-file
b
How did you deploy it? Typically you would have a
.tfvars
file with all the required variables values and pass the path to the file with `-var-file`(or you'd pass the values individually with
-var
). You need to pass those variables when deploying and also when destroying (the terraform command you run is the same, just change
apply
to
destroy
). https://developer.hashicorp.com/terraform/language/values/variables https://developer.hashicorp.com/terraform/cli/v1.5.x/commands/apply#apply-options https://developer.hashicorp.com/terraform/cli/v1.5.x/commands/destroy
b
Thank you! I'll try!
I deployed as usual with step-by-step explanation. There were some problems while
aws eks update-kubeconfig --name <cluster name> configure
, and I tried to reinit everything. Maybe afterwards I broke something. Now I don't have
.tfvars
a
if you deleted things manually its possible that tf destroy will no longer work, since its now out of sync.. there is a nuclear option https://github.com/rebuy-de/aws-nuke. But before that, if you want to try manually roughly the order you want to delete things is: • RDS instances / clusters • EKS clusters • EC2 Load balancers • EC2 Autoscaling groups • EC2 instances • EC2 network interfaces • Nat gateways / Internet Gateways • VPC