hetznercloud / terraform-provider-hcloud

Terraform Hetzner Cloud provider
https://registry.terraform.io/providers/hetznercloud/hcloud/latest
Mozilla Public License 2.0
479 stars 72 forks source link

fix(server): unable to attach two new networks #901

Closed apricote closed 3 months ago

apricote commented 3 months ago

The current validation fails if a user tries to attach two networks that are created in the same Apply run to a server. In this case, the ResourceDiff has both IDs set to 0, as that value is unknown at plan time. The current validation fails with error:

Error: server is only allowed to be attached to each network once: 0

We skip the validation in that case for now. The Terraform SDK v2 does not give us enough insights to figure out if both refer to the same resource or if they reference different network resources. We should revisit this validation after migrating to the Plugin Framework, as it gives us a lot more details about the proposed plan, and we might have enough info to give a definitive yay/nay to the user.

Closes #899

codecov[bot] commented 3 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 69.40%. Comparing base (deaa514) to head (6ed4f80).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #901 +/- ## ========================================== + Coverage 69.38% 69.40% +0.02% ========================================== Files 56 56 Lines 7732 7734 +2 ========================================== + Hits 5365 5368 +3 + Misses 1701 1699 -2 - Partials 666 667 +1 ``` | [Flag](https://app.codecov.io/gh/hetznercloud/terraform-provider-hcloud/pull/901/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hetznercloud) | Coverage Δ | | |---|---|---| | [e2e](https://app.codecov.io/gh/hetznercloud/terraform-provider-hcloud/pull/901/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hetznercloud) | `69.40% <100.00%> (+0.02%)` | :arrow_up: | | [unit](https://app.codecov.io/gh/hetznercloud/terraform-provider-hcloud/pull/901/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hetznercloud) | `33.70% <0.00%> (-0.01%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hetznercloud#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.