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

[Bug]: terraform tries to replace the machine type inplace #1058

Closed
hadmut opened this issue Dec 10, 2024 · 3 comments
Closed

[Bug]: terraform tries to replace the machine type inplace #1058

hadmut opened this issue Dec 10, 2024 · 3 comments
Labels

Comments

@hadmut
Copy link

hadmut commented Dec 10, 2024

What happened?

I change the machine type of a server definition, and terraform tries to do that:

Terraform will perform the following actions:

hcloud_server.web_test[0] will be updated in-place

~ resource "hcloud_server" "web_test" {
id = "57374955"
name = "webtest1"
~ server_type = "cax11" -> "cx22"
# (20 unchanged attributes hidden)
}

which necessarily fails since you can't change the server_type inplace.

What did you expect to happen?

destroy and replace

Please provide a minimal working example

create a simple cax11 machine, then change the type to cx22.

@hadmut hadmut added the bug label Dec 10, 2024
@jooola
Copy link
Member

jooola commented Dec 10, 2024

Could you provide use a code example so we can better understand and maybe reproduce your issue?

@hadmut
Copy link
Author

hadmut commented Dec 10, 2024

OK, here it is (attached file with an attached .txt since github refuses .tf files as not supported, just remove the .txt suffix
hetzner_debuga.tf.txt
).

Do
terraform init
terraform apply

which should run smoothly and succeed and create a cx22 machine.

Then change machine type from cx22 to cax11 and again, terraform apply.

terraform should now tear down the cx22 machine and replace it with a cax11, but it doesn't:

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
~ update in-place

Terraform will perform the following actions:

hcloud_server.debuga will be updated in-place

~ resource "hcloud_server" "debuga" {
id = "57398965"
name = "debuga"
~ server_type = "cx22" -> "cax11"
# (19 unchanged attributes hidden)
}

Plan: 0 to add, 1 to change, 0 to destroy.

and then, of course, fails, since a x86 machine cannot be changed into an ARM machine just by changing attributes:


│ Error: server type has incompatible architecture (invalid_server_type, 1719e2aab7fa2aa6)

│ with hcloud_server.debuga,
│ on hetzner_debuga.tf line 20, in resource "hcloud_server" "debuga":
│ 20: resource "hcloud_server" "debuga" {

@jooola
Copy link
Member

jooola commented Dec 10, 2024

This looks like a duplicate of #853, therefor I'll close this issue.

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

No branches or pull requests

2 participants