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

Service details not yet available in GovCloud. #3514

Merged
merged 2 commits into from
Mar 5, 2018

Conversation

jmcarp
Copy link
Contributor

@jmcarp jmcarp commented Feb 24, 2018

Revert to logic from 1.8 for GovCloud until service details are
supported.

Resolves #3506.

Note: I haven't had time to test this thoroughly, so it would be great to get help testing this out. cc @lorengordon @bflad

Revert to logic from 1.8 for GovCloud until service details are
supported.
@ghost ghost added the size/S Managed by automation to categorize the size of a PR. label Feb 24, 2018
@bflad bflad added bug Addresses a defect in current functionality. service/ec2 Issues and PRs that pertain to the ec2 service. labels Feb 24, 2018
@lorengordon
Copy link
Contributor

I can knock out a test if someone wouldn't mind providing a windows binary... though I can probably compile one myself tomorrow.

Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

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

I think we can skip the isGovCloud logic to handle both API responses in this case. The added bonus will also be that US Government's data source response will be enhanced when they upgrade the API in that partition.

e.g.

// replacing existing if resp == nil || len(resp.ServiceDetails) == 0 {
if resp == nil || len(resp.ServiceNames) == 0 {
  return fmt.Errorf("no matching VPC Endpoint Service found")
}

if len(resp.ServiceNames) > 1 {
  return fmt.Errorf("multiple VPC Endpoint Services matched; use additional constraints to reduce matches to a single VPC Endpoint Service")
}

if len(resp.ServiceDetails) == 0 {
  d.SetId(strconv.Itoa(hashcode.String(*resp.ServiceNames[0])))
  d.Set("service_name", resp.ServiceNames[0])
  return nil
}

// continue with sd := resp.ServiceDetails[0] logic onward


// Note: AWS Commercial now returns a response with `ServiceNames` and
// `ServiceDetails`, but GovCloud responses only include `ServiceNames`
if isGovCloud && resp.ServiceDetails == nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

As written, this line can cause a panic if resp == nil

@bflad bflad added this to the v1.11.0 milestone Feb 27, 2018
@ghost ghost added the size/S Managed by automation to categorize the size of a PR. label Mar 3, 2018
Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

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

LGTM, thanks! 🚀

Standard:

 make testacc TEST=./aws TESTARGS='-run=TestAccDataSourceAwsVpcEndpointService'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -run=TestAccDataSourceAwsVpcEndpointService -timeout 120m
=== RUN   TestAccDataSourceAwsVpcEndpointService_gateway
--- PASS: TestAccDataSourceAwsVpcEndpointService_gateway (10.59s)
=== RUN   TestAccDataSourceAwsVpcEndpointService_interface
--- PASS: TestAccDataSourceAwsVpcEndpointService_interface (9.43s)
=== RUN   TestAccDataSourceAwsVpcEndpointService_custom
--- PASS: TestAccDataSourceAwsVpcEndpointService_custom (298.66s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	318.713s

US Gov (manually):

terraform apply
data.aws_vpc_endpoint_service.s3: Refreshing state...

Apply complete! Resources: 0 added, 0 changed, 0 destroyed.

Outputs:

s3_endpoint = com.amazonaws.us-gov-west-1.s3

@bflad bflad merged commit 835c0b1 into hashicorp:master Mar 5, 2018
bflad added a commit that referenced this pull request Mar 5, 2018
@bflad
Copy link
Contributor

bflad commented Mar 9, 2018

This has been released in version 1.11.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

@lorengordon
Copy link
Contributor

@bflad Thanks, I just tested it and it looks like just going from v1.8.0 => v1.11.0 and changing nothing else at all it wants to destroy and recreate the s3 endpoint.

@lorengordon
Copy link
Contributor

Ahh, looks like this is the line that's changing and causing the new resource:

vpc_endpoint_type:       "" => "Gateway" (forces new resource)

@bflad bflad added the partition/aws-us-gov Pertains to the aws-us-gov partition. label Mar 12, 2018
@bflad
Copy link
Contributor

bflad commented Mar 12, 2018

Sorry for any confusion, @lorengordon, this pull request was specifically for the aws_vpc_endpoint data source returning "no matches" due to incorrect logic. The mentioned aws_vpc_endpoint resource (not data source) returning "" => "Gateway" (forces new resource) in US Gov partition will be addressed in pull request #3317, which I will probably be merging today if looks good and releasing in v1.12.0 of the AWS provider.

@lorengordon
Copy link
Contributor

@bflad No worries, thanks for following up. I just subscribed to that PR also!

@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
bug Addresses a defect in current functionality. partition/aws-us-gov Pertains to the aws-us-gov partition. service/ec2 Issues and PRs that pertain to the ec2 service. 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.

v1.9.0: VPC Endpoint Data Resource no longer works in GovCloud
3 participants