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

[HCS-1831] Remove extraneous protocol from fqdn string if present #95

Conversation

aclaygray
Copy link
Contributor

🛠️ Description

This PR updates the logic for generating the k8sAuthMethodHost within the hcp_consul_agent_helm_config data source.

As it stands now we always prepend an https:// protocol to the kubernetes_endpoint string provided. This updated logic will strip a leading https:// from the kubernetes_endpoint string and will leverage the existing logic to prepend the protocol again as needed. This will allow for handling of both cases of this string having a leading https:// and not.

🏗️ Local testing

With the following main.tf

<PROVIDER set-up>

data "hcp_consul_agent_helm_config" "test" {
  cluster_id = "consul-cluster"
  kubernetes_endpoint = "https://catter.com"
}

resulted with the following in terraform.state file:

...
k8sAuthMethodHost: https://catter.com:443
...

The above output is seen with the following main.tf as well:

<PROVIDER set-up>

data "hcp_consul_agent_helm_config" "test" {
  cluster_id = "consul-cluster"
  kubernetes_endpoint = "catter.com"
}

@aclaygray aclaygray requested review from roaks3, bcmdarroch and a team April 5, 2021 14:45
Copy link
Contributor

@roaks3 roaks3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@aclaygray aclaygray merged commit 30806e4 into main Apr 6, 2021
@aclaygray aclaygray deleted the aclaygray/f-HCS-1831-consul-agent-helm-config-adds-extraneous-https branch April 6, 2021 15:49
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