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

Change deployment-alias type to *string. #472

Merged
merged 2 commits into from
May 24, 2024

Conversation

gigerdo
Copy link
Member

@gigerdo gigerdo commented May 22, 2024

The deployment-alias field has the following behavior:

  • Not added in request -> Don't update field
  • Set to empty value -> Remove deployment alias
  • Set to non-empty value -> Set alias to that value

So with the old spec, it wasn't possible to remove the alias after it was set, as due to omitempty an empty value is not added to the request. This is now possible.

Description

Related Issues

Motivation and Context

How Has This Been Tested?

Types of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactoring (improves code quality but has no user-facing effect)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation

Readiness Checklist

  • My code follows the code style of this project
  • My change requires a change to the documentation
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed

The deployment-alias field has the following behavior:
- Not added in request -> Don't update field
- Set to empty value -> Remove deployment alias
- Set to non-empty value -> Set alias to that value

So with the old spec, it wasn't possible to remove the alias after it was set, as due to `omitempty` an empty value is not added to the request. This is now possible.
@gigerdo gigerdo marked this pull request as ready for review May 24, 2024 08:17
@gigerdo gigerdo requested a review from a team as a code owner May 24, 2024 08:17
@gigerdo gigerdo merged commit 3312360 into elastic:master May 24, 2024
2 checks passed
gigerdo added a commit to elastic/terraform-provider-ec that referenced this pull request Jun 24, 2024
Fixes an error scenario when using the empty string for alias:
- The expectation is to remove the alias
- The empty string used to not be transferred to the backend, so no update to the alias was made
- This lead to a terraform error as the resulting state was different from the config

Now the behavior is:
- Unconfigured -> alias is left untouched and not managed by terraform (When creating this will add a default alias)
- Set to empty string -> alias is removed
- Set to non-empty string -> alias is set to this value

Related change in cloud-sdk-go: elastic/cloud-sdk-go#472
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