1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00
Files
openshift-docs/modules/rosa-sts-cluster-terraform-destroy.adoc
2025-09-04 19:48:52 +00:00

123 lines
3.2 KiB
Plaintext

// Module included in the following assemblies:
//
// * rosa_hcp/terraform/rosa-hcp-creating-a-cluster-quickly-terraform.adoc
// * rosa_install_access_delete_clusters/terraform/rosa-classic-creating-a-cluster-quickly-terraform.adoc
ifeval::["{context}" == "rosa-classic-creating-a-cluster-quickly-terraform"]
:tf-defaults:
endif::[]
ifeval::["{context}" == "rosa-hcp-creating-a-cluster-quickly-terraform"]
:tf-rosa-hcp:
endif::[]
:_content-type: PROCEDURE
[id="sd-terraform-cluster-destroy_{context}"]
= Deleting your {product-title} cluster with Terraform
Use the `terraform destroy` command to remove all of the resources that were created with the `terraform apply` command.
[NOTE]
====
Do not modify your Terraform `.tf` files before destroying your resources. These variables are matched to resources to delete.
====
.Procedure
. In the directory where you ran the `terraform apply` command to create your cluster, run the following command to delete the cluster:
+
[source,terminal]
----
$ terraform destroy
----
+
The Terraform interface prompts you for two variables. These should match the answers you provided when creating a cluster:
+
[source,terminal]
----
var.create_vpc
If you would like to create a new VPC, set this value to 'true.' If you do not want to create a new VPC, set this value to 'false.'
Enter a value:
var.private_cluster
If you want to create a private cluster, set this value to 'true.' If you want a publicly available cluster, set this value to 'false.'
Enter a value:
----
. Enter `yes` to start the role and cluster deletion:
ifdef::tf-rosa-hcp[]
+
.Example output
[source,terminal]
----
Plan: 0 to add, 0 to change, 63 to destroy.
Do you really 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
----
endif::tf-rosa-hcp[]
ifdef::tf-rosa-classic[]
+
.Example output
[source,terminal]
----
Plan: 0 to add, 0 to change, 74 to destroy.
Do you really 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
----
endif::tf-rosa-classic[]
.Verification
. Verify that your cluster was destroyed by running the following command:
+
[source,terminal]
----
$ rosa list clusters
----
+
.Example output showing no cluster
[source,terminal]
----
I: No clusters available
----
. Verify that the account roles were destroyed by running the following command:
+
[source,terminal]
----
$ rosa list account-roles
----
+
.Example output showing no Terraform-created account roles
[source,terminal]
----
I: Fetching account roles
I: No account roles available
----
. Verify that the Operator roles were destroyed by running the following command:
+
[source,terminal]
----
$ rosa list operator-roles
----
+
.Example output showing no Terraform-created Operator roles
[source,terminal]
----
I: Fetching operator roles
I: No operator roles available
----
ifeval::["{context}" == "rosa-classic-creating-a-cluster-quickly-terraform"]
:tf-defaults:
endif::[]
ifeval::["{context}" == "rosa-hcp-creating-a-cluster-quickly-terraform"]
:tf-rosa-hcp:
endif::[]