-
Notifications
You must be signed in to change notification settings - Fork 9.7k
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
#7013 add tls config support to consul provider #7015
#7013 add tls config support to consul provider #7015
Conversation
Thanks for the PR here, sorry it has taken so long to get to it! I think in order to merge it, we would really love to see some updates to the documentation to reflect this. Have you been able to test that this works as expected? Could you possibly also turn in an acceptance test as well? Thanks Paul |
Hey @stack72 thanks, and no worries! Will add documentation. Have been using it in production for some time, but will also add an acceptance test. Will ping again when the changes are in. |
Awesome! Thanks :) |
Hey @stack72, I created a test that validates the provider config when It's also possible to run all of the existing Consul acceptance tests so that any which connect to a Consul agent will use TLS. This requires first setting some environment variables, and pointing the Consul provider to an agent that serves (and optionally authenticates) HTTPS requests. I included a README which will hopefully make this clear. Please note that, if you configure the acceptance tests to connect to a Consul agent not addressable at I hope this is satisfactory - let me know if there's anything I can do to improve this. |
tlsConfig.CAFile = c.CAFile | ||
tlsConfig.CertFile = c.CertFile | ||
tlsConfig.KeyFile = c.KeyFile | ||
cc, err := consulapi.SetupTLSConfig(tlsConfig) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can these values be empty? Or should we check they are set in the config object before being set as a tlsConfig object?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consul/api.TLSConfig{CAFile,CertFile,KeyFile}
are all string
. Their default values are ""
, so checking to see if terraform/consul.TLSConfig.{CAFile,CertFile,KeyFile}
(also string
) are ""
before assigning is unnecessary.
(Answer to your other question below.)
So i ran the tests here and they look good. I have a few small questions inline - so if you can have a think about those before i merge, then that would be awesome
Thanks for all the work here! Paul |
…running consul acc tests
@maxenglander thanks for the very good explanations :) the changes work on a non-tls enabled cluster so we look good to merge! |
@stack72 Awesome - thanks for the review and merge! |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Resolves #7013.
Note that I updated the vendored Consul API by running
govendor fetch github.com/hashicorp/consul/api
.