-
Notifications
You must be signed in to change notification settings - Fork 74
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]: After importing hcloud_server terraform plan is showing fields to be updated #944
Comments
This happened to me as well, it looks like the The weird thing though, I copied the network section for private network, but no matter what the IP you put it doesn't trigger a change. Anyway, now no changes are shown in plan. {
"network": [
{
"alias_ips": [],
"ip": "INTERNAL_IP",
"mac_address": "MA:CA:DD:RE:SS:00",
"network_id": NETWORK_ID
}
],
"public_net": [
{
"ipv4": IPV4_ID,
"ipv4_enabled": true,
"ipv6": IPV6_ID,
"ipv6_enabled": true
}
],
} |
I can reproduce the issue. I have written an acceptance test that also exhibits the bug: func TestServerResource_ImportPublicNet(t *testing.T) {
// Regression test for https://github.com/hetznercloud/terraform-provider-hcloud/issues/944
var s hcloud.Server
sk := sshkey.NewRData(t, "server-import-public-net")
res := &server.RData{
Name: "server-import-public-net",
Type: teste2e.TestServerType,
Image: teste2e.TestImage,
SSHKeys: []string{sk.TFID() + ".id"},
PublicNet: map[string]interface{}{
"ipv4_enabled": true,
"ipv6_enabled": true,
},
}
res.SetRName("server-import-public-net")
tmplMan := testtemplate.Manager{}
resource.ParallelTest(t, resource.TestCase{
PreCheck: teste2e.PreCheck(t),
ProtoV6ProviderFactories: teste2e.ProtoV6ProviderFactories(),
CheckDestroy: testsupport.CheckResourcesDestroyed(server.ResourceType, server.ByID(t, &s)),
Steps: []resource.TestStep{
{
Config: tmplMan.Render(t,
"testdata/r/hcloud_ssh_key", sk,
"testdata/r/hcloud_server", res,
),
Check: resource.ComposeTestCheckFunc(
testsupport.CheckResourceExists(res.TFID(), server.ByID(t, &s)),
),
},
{
// Try to import the newly created Server. Verify that import of "public_net" works
ResourceName: res.TFID(),
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"ssh_keys", "user_data", "keep_disk", "ignore_remote_firewall_ids", "allow_deprecated_images", "shutdown_before_deletion",
},
},
},
})
} @phoewass You have some additional changes in between the actual configuration of your server and what you have defined in terraform:
|
The bugs from #597 are still there and can not be fixed with the SDKv2. We will need to migrate the Sorry for this annoying resolution :( |
What happened?
I created a terraform hcloud_server to import my server that I created manually.
Then I import it:
terraform import hcloud_server.my_server XXXXXXX
It works fine but when I execute
terraform plan
I see this result:What did you expect to happen?
terraform plan
should show:Looking at "terraform.tfstate" file after import, everything looks fine:
Please provide a minimal working example
terraform: 1.8.4
hetznercloud/hcloud: 1.47
terraform import hcloud_server.my_server XXXXXXX
terraform plan
The text was updated successfully, but these errors were encountered: