-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
Allow custom endpoints to override the use_fips_endpoint flag for individual services. #34233
Allow custom endpoints to override the use_fips_endpoint flag for individual services. #34233
Conversation
Community NoteVoting for Prioritization
For Submitters
|
989c10f
to
2c42ac4
Compare
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.
Welcome @danielgmyers-figma 👋
It looks like this is your first Pull Request submission to the Terraform AWS Provider! If you haven’t already done so please make sure you have checked out our CONTRIBUTOR guide and FAQ to make sure your contribution is adhering to best practice and has all the necessary elements in place for a successful approval.
Also take a look at our FAQ which details how we prioritize Pull Requests for inclusion.
Thanks again, and welcome to the community! 😃
I could use some help understanding something. My new acceptance test passed, but when I did However, now I don't understand why my new acceptance test was passing. If I remove the endpoint override from the test config, it fails with a "no such host" error trying to resolve the nonexistent FIPS endpoint for AppConfig, as I expect; however, with the endpoint override in place, it successfully creates the appconfig resource with or without my code change. One possibility that comes to mind is that it's possible the acceptance tests are using v1 of the AWS SDK for some reason, while runtime uses v2, since I believe the "Invalid Configuration: FIPS and custom endpoint are not supported" check was only added to AWS SDK v2. Is that possible? If so, how is that controlled? If not, what else might I be missing? |
b0e7de6
to
a7be484
Compare
Thanks for submitting this, @danielgmyers-figma. We've been having a few discussions internally and with our AWS contacts around FIPS and endpoint overrides. It was mostly prompted by #33952. Generally, not all services support FIPS, but AWS SDK implementation
(aws/aws-sdk-go-v2#2336 (comment)). This behaviour is consistent with the AWS CLI, so it seems to be an overall design decision from AWS. I suspect that the inability to override endpoints when Thanks for all of the work you put into this PR. We're going to investigate updating endpoint resolution to V2, but keep this PR open in case that doesn't address it. |
Sounds good, thanks @gdavison! |
a7be484
to
43696d9
Compare
… and `use_fips_endpoint`
12784c9
to
1735743
Compare
This functionality has been released in v5.53.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you! |
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Description
The
use_fips_endpoint
flag is handled as a global setting by terraform-provider-aws; this is generally a good thing, since if you're using FIPS endpoints you probably always want to use FIPS endpoints.Unfortunately the AWS SDK does not always handle this correctly. For some services, such as AppConfig or CloudFront, the SDK generates a nonexistent or incorrect FIPS endpoint, so those resources can't be managed with the flag enabled.
It seems this has come up before in various issues (e.g. #23619, #25732) and the recommended workaround in those cases seems to have been to override the endpoint like this:
However, that workaround stopped working at some point; the AWS SDK now emits this error:
In principle, the correct solution is to report the issue to AWS so that they can update the SDK with the correct endpoint configuration in these cases, then wait for the SDK to release an update, then wait for terraform-provider-aws to pick it up. However, users still need a workaround in the meantime, and the previously-used workaround no longer works.
This change addresses that problem; now, the provider's AWS client initialization code checks for the case where both
use_fips_endpoint
is true and a custom endpoint is provided and, if so, explicitly disables the client'sUseFIPSEndpoint
configuration prior to initialization. The custom endpoint is now honored and a warning is logged.I updated the documentation for the provider's
use_fips_endpoint
andendpoints
fields to reflect the new behavior.I added two new acceptance tests (
TestAccProvider_useFipsEndpointFlag
andTestAccProvider_overrideUseFipsEndpointFlagForOneService
) and renamed one of the existing tests (TestAccProvider_fipsEndpoint
->TestAccProvider_customEndpoint
).Relations
This is related to several open issues (many of the ones in this search) but I would hesitate to say it fixes any of them; instead this change simply allows a previously-recommended workaround to continue functioning.
References
Output from Acceptance Testing