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

Case-insensitive comparison of IPv6 addresses #468

Merged
merged 1 commit into from
Sep 17, 2021

Conversation

fhofherr
Copy link
Contributor

Our API converts upper-case IPv6 addresses to lower-case. This in turn
leads to a mismatch between what is stored in the Terraform state and
what our API returns. As a result Terraform tries to update a rule,
which does not need updating.

The solution is to convert any IP addresses to lower-case before
Terraform saves them to the state. This can be easily achieved using the
StateFunc field of schema.Schema. However, when the field is used within
a schema element of schema.TypeSet it creates an additional invalid
value. This to be a known bug in Terraform:
hashicorp/terraform-plugin-sdk#160

For our case we can get by with filtering the invalid entry from the
firewall rules before sending any requests to the API.

Our API converts upper-case IPv6 addresses to lower-case. This in turn
leads to a mismatch between what is stored in the Terraform state and
what our API returns. As a result Terraform tries to update a rule,
which does not need updating.

The solution is to convert any IP addresses to lower-case before
Terraform saves them to the state. This can be easily achieved using the
StateFunc field of schema.Schema. However, when the field is used within
a schema element of schema.TypeSet it creates an additional invalid
value. This to be a known bug in Terraform:
hashicorp/terraform-plugin-sdk#160

For our case we can get by with filtering the invalid entry from the
firewall rules before sending any requests to the API.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants