Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Root volume surviving »terraform destroy« #577

Open
wirepatch opened this issue Oct 26, 2024 · 1 comment
Open

Root volume surviving »terraform destroy« #577

wirepatch opened this issue Oct 26, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@wirepatch
Copy link

Consider a single server deployment:

...
provider "stackit" {
...
enable_beta_resources = true
}

resource "stackit_security_group" "standard-access" {
  name       = "my_security_group" ...
}

resource "stackit_security_group_rule" "ssh-access" {  ... } # allow ssh
resource "stackit_network" "intern" { ... }
resource "stackit_network_interface" "hello-interface" { ... }
resource "stackit_public_ip" "helloip" {...}

resource "stackit_server" "hello" {
  project_id        = "..."
  name              = "hello-server"
  availability_zone = "eu01-1"
  machine_type      = "t1.1"
  boot_volume       = {
        size              = 10
        performance_class = "storage_premium_perf0"
        source_type       = "image"
        source_id         = "d789a7b4-1efc-4148-be60-de97bc516b6b" # Debian 12 image
    }
}

resource "stackit_server_network_interface_attach" "attached_network_interface" { ... }

terraform apply will create the desired server but on terraform destroy the boot device won't be destroyed:

Name    | Status    | Server     | Availability zones| Size  |  
No name | Available | -          | eu01-1            | 10 GB |  

The web portal provides a Delete root volume when deleting server option not being present here. Besides the general expectation with regards to terraform destroy is cleaning up all resources previously being created.

BTW: It would be very helpful if the provider allowed for provisioning the STACKIT Server Agent like the web portal does. This might be possible by using cloud-init. But in case of a cloud init failure there is no way e.g. setting a password manually for accessing the host in question to debug the problem.

@vicentepinto98 vicentepinto98 added the enhancement New feature or request label Oct 28, 2024
@joaopalet
Copy link
Contributor

Hi @wirepatch,

Thanks for the suggestion!

After discussing with the STACKIT IaaS team, we will provide a field to enable the root volume to be deleted when destroying the server via Terraform.

This will only be supported for root volumes created from an image source type (like the one in your example). Since in the case the source type is volume, the server will use an existing volume and deleting it could cause inconsistencies in the Terraform configuration.

We will update you once this is addressed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants