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

Remove validators.Known() on endpoint. #866

Merged
merged 1 commit into from
Oct 11, 2024

Conversation

GeorgeGkinis
Copy link
Contributor

@GeorgeGkinis GeorgeGkinis commented Oct 11, 2024

This removes validators.Known() from the ec.endpoint parameter.
This will allow setting ec.endpoint as a variable and prevents an error "Value must be known" during terraform plan

Description

We want to dynamically change the endpoint URL using variables during CI/CD deployments.
It is currently not possible because during terraform plan ec.endpoint is not filled with the given variable:

provider "ec" {
  endpoint = var.ECE_CONSOLE_URL
  apikey = var.ECE_CONSOLE_API_KEY
}

local.auto.tfvars:

ECE_CONSOLE_URL = "https://console.ece.mydomain.com"
ECE_CONSOLE_API_KEY = "myapikey"

The endpoint field is also declared as optional in the code and according to documentation has a default value of "https://api.elastic-cloud.com"

Related Issues

#869

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

Copy link

cla-checker-service bot commented Oct 11, 2024

💚 CLA has been signed

@GeorgeGkinis GeorgeGkinis force-pushed the Fix-ec.endpoint-as-variable branch from 3426f37 to 6f6c1b8 Compare October 11, 2024 09:51
@GeorgeGkinis GeorgeGkinis reopened this Oct 11, 2024
@GeorgeGkinis
Copy link
Contributor Author

GeorgeGkinis commented Oct 11, 2024

@tobio @gigerdo Could you please take a look at this?
I am curious why validators.Known() was needed for ec.endpoint and as such if this is a breaking change.
I suppose not, because everyone had to explicitly set ec.endpoint up until now.

Maybe this should be fixed in validators.Known()?
If there is a default value the Known validator should always return no problem?

Thanks!

@gigerdo
Copy link
Member

gigerdo commented Oct 11, 2024

Yes, I think you are right. It should be fine to remove the validation, so it works to use variables in the config.

cc @dimuon

@GeorgeGkinis
Copy link
Contributor Author

@gigerdo I believe the regression test error is unrelated to my change?

@GeorgeGkinis GeorgeGkinis marked this pull request as ready for review October 11, 2024 11:48
@GeorgeGkinis GeorgeGkinis requested a review from a team as a code owner October 11, 2024 11:48
@dimuon
Copy link
Contributor

dimuon commented Oct 11, 2024

@GeorgeGkinis , looks like it caused by hashicorp/terraform-provider-aws#39676.

@GeorgeGkinis
Copy link
Contributor Author

@dimuon Should I make another pull request to implement the workaround in providers.tf or should we wait until it is resolved by Hashicorp?

@dimuon
Copy link
Contributor

dimuon commented Oct 11, 2024

@GeorgeGkinis let's proceed with the workaround. Thanks for the contribution!

@GeorgeGkinis
Copy link
Contributor Author

@dimuon Check #867

@GeorgeGkinis GeorgeGkinis force-pushed the Fix-ec.endpoint-as-variable branch from c0a6814 to 0454967 Compare October 11, 2024 15:01
@GeorgeGkinis
Copy link
Contributor Author

@dimuon Maybe try running these test once again?
I rebased this branch on top of master with #867

@dimuon dimuon merged commit b19220f into elastic:master Oct 11, 2024
2 checks passed
@GeorgeGkinis
Copy link
Contributor Author

@dimuon Njoy the weekend!

@dimuon
Copy link
Contributor

dimuon commented Oct 11, 2024

Thank you @GeorgeGkinis, wishing you a great weekend too!

@GeorgeGkinis
Copy link
Contributor Author

@dimuon Is there a known release date with this fix?
We cannot deploy from our CI/CD until this is released, but we can wait a week or 2.

@dimuon
Copy link
Contributor

dimuon commented Oct 29, 2024

@GeorgeGkinis , there is no specific date for the new release but I suppose we can release the fix soon.

@dimuon dimuon mentioned this pull request Nov 5, 2024
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.

3 participants