terraform destroy
デストロイ
$ terraform plan --destroy
$ terraform destroy
省略 planの動作と同様な結果が表示されます
data.aws_ssm_parameter.amzn2_ami: Refreshing state...
aws_instance.demo: Refreshing state... [id=ec2インスタンスID]
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
- destroy
Terraform will perform the following actions:
# aws_instance.demo:
resource "aws_instance" "demo" {
ami = "amiID" -> null
arn = "arnID" -> null
associate_public_ip_address = true -> null
availability_zone = "us-west-2a"
cpu_core_count = 1 -> null
cpu_threads_per_core = 1 -> null
disable_api_termination = false -> null
ebs_optimized = false -> null
id = "ec2インスタンスID" -> null
instance_state = "running" -> null
instance_type = "t2.micro" -> null
ipv6_address_count = 0 -> null
ipv6_addresses = [] -> null
monitoring = false -> null
primary_network_interface_id = "eniID" -> null
private_dns = "プライベートDNS名" -> null
private_ip = "プライベートIPアドレス" -> null
public_dns = "パブリックDNS名" -> null
public_ip = "パブリックIPアドレス" -> null
security_groups = [
"default",
] -> null
source_dest_check = true -> null
subnet_id = "subnetID" -> null
tenancy = "default" -> null
volume_tags = {} -> null
vpc_security_group_ids = [
"sgID",
] -> null
credit_specification {
cpu_credits = "standard" -> null
}
root_block_device {
delete_on_termination = true -> null
iops = 100 -> null
volume_id = "volID" -> null
volume_size = 8 -> null
volume_type = "gp2" -> null
}
}
Plan: 0 to add, 0 to change, 1 to destroy.
Do you want to destroy all resources?
Terraform will destroy all your managed infrastructure, as shown above.
There is no undo. Only 'yes' will be accepted to confirm.
Enter a value: yes 入力します
aws_instance.demo: Destroying... [id=ec2インスタンスID]
aws_instance.demo: Still destroying... [id=ec2インスタンスID]
aws_instance.demo: Still destroying... [id=ec2インスタンスID]
aws_instance.demo: Still destroying... [id=ec2インスタンスID]
aws_instance.demo: Destruction complete after 32s
Destroy complete! Resources: 1 destroyed.