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

fix(load-balancer): automatic import of target adds conflicting fields #962

Merged
merged 1 commit into from
Jul 24, 2024

Conversation

apricote
Copy link
Member

The fields ip and use_private_ip are marked as conflicting because use_private_ip only takes effect with label selector and server id targets.

So far we have always set use_private_ip to whatever the API returned. But this causes issues with the command terraform plan -generate-config-out= as it writes all attributes we set in the state to a TF file. For an LB Target IP this now causes a conflict because both fields are set.

This is fixed by only setting the field when the target type is not IP.

Closes #961

The fields `ip` and `use_private_ip` are marked as conflicting because
`use_private_ip` only takes effect with label selector and server id
targets.

So far we have always set `use_private_ip` to whatever the API returned.
But this causes issues with the command `terraform plan
-generate-config-out=` as it writes all attributes we set in the state
to a TF file. For an LB Target IP this now causes a conflict because
both fields are set.

This is fixed by only setting the field when the target type is not IP.

Closes #961.
Copy link

codecov bot commented Jul 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 69.64%. Comparing base (74d822a) to head (c986ed3).

Additional details and impacted files
@@             Coverage Diff             @@
##             main     #962       +/-   ##
===========================================
+ Coverage   34.06%   69.64%   +35.57%     
===========================================
  Files          63       63               
  Lines        7928     7929        +1     
===========================================
+ Hits         2701     5522     +2821     
+ Misses       5188     1709     -3479     
- Partials       39      698      +659     
Flag Coverage Δ
e2e 69.64% <100.00%> (?)
unit 34.06% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@apricote apricote merged commit 6c0b1c4 into main Jul 24, 2024
7 checks passed
@apricote apricote deleted the lb-target-field-conflict branch July 24, 2024 07:58
apricote pushed a commit that referenced this pull request Jul 25, 2024
🤖 I have created a release *beep* *boop*
---


##
[1.48.0](v1.47.0...v1.48.0)
(2024-07-25)


### Features

* add support for opentofu v1.7
([#950](#950))
([ae115a8](ae115a8))
* add support for terraform v1.9
([#949](#949))
([642ac15](642ac15))
* drop support for terraform v1.7.x
([#947](#947))
([f6372aa](f6372aa))
* **server-type:** mark included_traffic attribute as deprecated
([#963](#963))
([e8101cc](e8101cc))


### Bug Fixes

* do not continue if an api error occurred
([#958](#958))
([85a4dd0](85a4dd0))
* **load-balancer:** automatic import of target adds conflicting fields
([#962](#962))
([6c0b1c4](6c0b1c4)),
closes
[#961](#961)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: hcloud_load_balancer_target import failed if the target is ip
2 participants