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

Add option to force Gov/China Cloud #3727

Closed
wants to merge 2 commits into from

Conversation

sodre
Copy link

@sodre sodre commented Mar 9, 2018

Sometimes it is necessary to use the China/GovCloud logic when using custom endpoints.

This PR allows the user to configure those options.

  - This allows the use of a custom endpoint that mimics China/GovCloud
@ghost ghost added the size/S Managed by automation to categorize the size of a PR. label Mar 9, 2018
@sodre sodre force-pushed the f-force-gov-cn-cloud-option branch from 1559cb9 to ff45e52 Compare March 11, 2018 00:33
@ghost ghost added the size/S Managed by automation to categorize the size of a PR. label Mar 11, 2018
@bflad
Copy link
Contributor

bflad commented Mar 12, 2018

@sodre we don't necessarily want to keep utilizing the isGovCloud() and isChinaCloud() logic. It is not implemented in very many places and could cause trouble if/when APIs in those AWS partitions are upgraded. Especially for non-AWS implementations, we may want to introduce separate logic.

Can you explain where you're running into trouble and maybe we can instead improve the resources themselves?

@bflad bflad added enhancement Requests to existing resources that expand the functionality or scope. provider Pertains to the provider itself, rather than any interaction with AWS. labels Mar 12, 2018
@sodre
Copy link
Author

sodre commented Mar 12, 2018

@bflad For testing purposes, we run something similar to localstack that has the same behavior as the actual GovCloud/China partition. In order to connect to those endpoints I need to configure custom endpoints and a custom region.

The custom region is not detected as being part of GovCloud/China partition and Terraform fails exactly where there are checks for "isGovCloud/isChina". The purpose of the patch is to let us inform terraform that those custom endpoints/custom region has the same "quirks" as GovCloud/ChinaCloud, e.g. #3317.

e.g. #3317.

@bflad
Copy link
Contributor

bflad commented Mar 12, 2018

@sodre I asked in that PR that the isGovCloud() check be removed and instead to infer the correct behavior for an "out of date" API endpoint with a code comment (in that case: default the VPC endpoint type to Gateway if it wasn't returned from the API). Basically, this is to automatically future-proof the resource for if/when AWS updates the US Gov partition.

I think we would personally prefer to fix other resources similarly to handle these situations rather than introduce and depend on any specific non-standard checks that will later require manual intervention. I worry that we can run into scenarios where now an update to remove a check like isGovCloud() (because it really is no longer needed) would now break configurations depending on the behavior of this new force_gov_cloud until the "localstack", etc. APIs were updated. At worst, we could create a separate check/config for each non-standard API.

Do you have other examples?

@sodre
Copy link
Author

sodre commented Mar 12, 2018

Realistically, this issue will come up everywhere where IsGovCloud or IsChinaCloud is used in your code.

@bflad
Copy link
Contributor

bflad commented Mar 12, 2018

Thanks. Are you able to set region = "us-gov-west-1" to workaround the behavior for now?

@sodre
Copy link
Author

sodre commented Mar 12, 2018

not really :(

@sodre
Copy link
Author

sodre commented Mar 12, 2018

@bflad,
The reason I proposed the PR as configuration option was because it is very close semantically to SkipRegionValidation. In the PR we are saying "Region is Gov/ChinaCloud"

Unfortunately, the choice of the region name is outside the developers hand. That is why I think changing the region name would not fix it. Isn't that also used to create validate the ARNs?

@sodre
Copy link
Author

sodre commented Mar 14, 2018

Hi @bflad,

So I can inform the folks on my side, is there a plan to merge this PR?

@bflad
Copy link
Contributor

bflad commented Mar 15, 2018

I talked with a few people and we believe this will cause maintenance or confusion issues in the future. We would happily accept changes to the resources to allow "backwards" compatibility though (e.g. removing the IsGovCloud() checks).

For example, the SQS resource can be adjusted to skip returning an error on the InvalidAction instead of relying on the IsGovCloud() check. I can submit a PR for this tomorrow.

@sodre
Copy link
Author

sodre commented Mar 15, 2018

No problem. Thanks for responding quickly. We will wait for your PR.

@bflad
Copy link
Contributor

bflad commented Mar 15, 2018

As promised, PR submitted: #3794

If you could locally build and test the provider from that PR in your environment that would be fantastic. 👍

As for other resources where you have or will run into this, please submit new separate issues for each resource and they can pretty easily be addressed. Most importantly, we will be looking for the exact error message as each service implements these errors differently.

@bflad bflad closed this in #3794 Mar 15, 2018
@sodre sodre deleted the f-force-gov-cn-cloud-option branch March 16, 2018 17:30
@sodre
Copy link
Author

sodre commented Mar 16, 2018

@bflad I'll get back to you on Monday! Thank you for getting to it so quickly.

@bflad
Copy link
Contributor

bflad commented Mar 23, 2018

The SQS ListQueueTags fix has been released in version 1.12.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

@ghost
Copy link

ghost commented Apr 7, 2020

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. provider Pertains to the provider itself, rather than any interaction with AWS. size/S Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants