hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.76k stars 9.11k forks source link

Terraform apply failing with 'unexpected EOF' when building an aws_api_gateway_method_settings with cache_data_encrypted property set to true. #6902

Closed ebower12 closed 5 years ago

ebower12 commented 5 years ago

Community Note

Terraform Version

Terraform v0.11.10 provider.aws v1.52

Affected Resource(s)

aws_api_gateway_method_settings

Terraform Configuration Files

resource "aws_api_gateway_method_settings" "Test-Stage-1-method-settings" {
  rest_api_id                            = "${aws_api_gateway_rest_api.Method-Settings-Test.id}"
  stage_name                             = "${aws_api_gateway_stage.Test-Stage-1.stage_name}"
  method_path                            = "*/*"
  settings                               = {
    caching_enabled                      = true
    cache_data_encrypted                 = true
    cache_ttl_in_seconds                 = "30"
    require_authorization_for_cache_control = true
    unauthorized_cache_control_header_strategy = "FAIL_WITH_403"
    metrics_enabled                      = true
    logging_level                        = "INFO"
    data_trace_enabled                   = true
    throttling_burst_limit               = "30000"
    throttling_rate_limit                = "30000"
  }
}

Debug Output

aws_api_gateway_method_settings.Test-Stage-1-method-settings: Modifying... (ID: txit8j349k-Test-Stage-1-*/*)
  settings.0.cache_data_encrypted: "false" => "true"
2018-12-18T11:35:51.016-0500 [DEBUG] plugin.terraform-provider-aws_v1.52.0_x4: panic: interface conversion: interface {} is bool, not int
2018-12-18T11:35:51.016-0500 [DEBUG] plugin.terraform-provider-aws_v1.52.0_x4: 
2018-12-18T11:35:51.016-0500 [DEBUG] plugin.terraform-provider-aws_v1.52.0_x4: goroutine 297 [running]:
2018-12-18T11:35:51.016-0500 [DEBUG] plugin.terraform-provider-aws_v1.52.0_x4: github.com/terraform-providers/terraform-provider-aws/aws.resourceAwsApiGatewayMethodSettingsUpdate(0xc00030c5b0, 0x3a95500, 0xc0001b9500, 0x24, 0x6febe20)
2018-12-18T11:35:51.016-0500 [DEBUG] plugin.terraform-provider-aws_v1.52.0_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_api_gateway_method_settings.go:191 +0x26ec
2018-12-18T11:35:51.016-0500 [DEBUG] plugin.terraform-provider-aws_v1.52.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema.(*Resource).Apply(0xc00027ed90, 0xc000979860, 0xc0005fcd00, 0x3a95500, 0xc0001b9500, 0x100b601, 0xc000c59b80, 0x10bc0fc)
2018-12-18T11:35:51.016-0500 [DEBUG] plugin.terraform-provider-aws_v1.52.0_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/resource.go:231 +0x250
2018-12-18T11:35:51.016-0500 [DEBUG] plugin.terraform-provider-aws_v1.52.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema.(*Provider).Apply(0xc0006dda40, 0xc000979810, 0xc000979860, 0xc0005fcd00, 0xc00006e000, 0x18, 0x843b000)
2018-12-18T11:35:51.016-0500 [DEBUG] plugin.terraform-provider-aws_v1.52.0_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/provider.go:283 +0x9c
2018-12-18T11:35:51.016-0500 [DEBUG] plugin.terraform-provider-aws_v1.52.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/plugin.(*ResourceProviderServer).Apply(0xc0004b2ce0, 0xc0004ddea0, 0xc000607140, 0x0, 0x0)
2018-12-18T11:35:51.017-0500 [DEBUG] plugin.terraform-provider-aws_v1.52.0_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/plugin/resource_provider.go:527 +0x57
2018-12-18T11:35:51.017-0500 [DEBUG] plugin.terraform-provider-aws_v1.52.0_x4: reflect.Value.call(0xc00016a840, 0xc00000c9d8, 0x13, 0x40684db, 0x4, 0xc000c59f18, 0x3, 0x3, 0xc000162940, 0xc000160100, ...)
2018-12-18T11:35:51.017-0500 [DEBUG] plugin.terraform-provider-aws_v1.52.0_x4:  /opt/goenv/versions/1.11.1/src/reflect/value.go:447 +0x449
2018-12-18T11:35:51.017-0500 [DEBUG] plugin.terraform-provider-aws_v1.52.0_x4: reflect.Value.Call(0xc00016a840, 0xc00000c9d8, 0x13, 0xc000a03f18, 0x3, 0x3, 0x12a05f200, 0xc000a03f10, 0x100010000)
2018-12-18T11:35:51.017-0500 [DEBUG] plugin.terraform-provider-aws_v1.52.0_x4:  /opt/goenv/versions/1.11.1/src/reflect/value.go:308 +0xa4
2018-12-18T11:35:51.017-0500 [DEBUG] plugin.terraform-provider-aws_v1.52.0_x4: net/rpc.(*service).call(0xc000163380, 0xc000598be0, 0xc000972cc8, 0xc000972ce0, 0xc0009e2480, 0xc0004cf400, 0x3517ba0, 0xc0004ddea0, 0x16, 0x3517be0, ...)
2018-12-18T11:35:51.017-0500 [DEBUG] plugin.terraform-provider-aws_v1.52.0_x4:  /opt/goenv/versions/1.11.1/src/net/rpc/server.go:384 +0x14e
2018-12-18T11:35:51.017-0500 [DEBUG] plugin.terraform-provider-aws_v1.52.0_x4: created by net/rpc.(*Server).ServeCodec
2018-12-18T11:35:51.017-0500 [DEBUG] plugin.terraform-provider-aws_v1.52.0_x4:  /opt/goenv/versions/1.11.1/src/net/rpc/server.go:481 +0x47e
2018/12/18 11:35:51 [TRACE] root: eval: *terraform.EvalWriteState
2018/12/18 11:35:51 [TRACE] root: eval: *terraform.EvalApplyProvisioners
2018/12/18 11:35:51 [TRACE] root: eval: *terraform.EvalIf
2018/12/18 11:35:51 [TRACE] root: eval: *terraform.EvalWriteState
2018/12/18 11:35:51 [TRACE] root: eval: *terraform.EvalWriteDiff
2018/12/18 11:35:51 [TRACE] root: eval: *terraform.EvalApplyPost
2018/12/18 11:35:51 [ERROR] root: eval: *terraform.EvalApplyPost, err: 1 error(s) occurred:

* aws_api_gateway_method_settings.Test-Stage-1-method-settings: unexpected EOF
2018/12/18 11:35:51 [ERROR] root: eval: *terraform.EvalSequence, err: 1 error(s) occurred:

* aws_api_gateway_method_settings.Test-Stage-1-method-settings: unexpected EOF
2018/12/18 11:35:51 [TRACE] [walkApply] Exiting eval tree: aws_api_gateway_method_settings.Test-Stage-1-method-settings
2018-12-18T11:35:51.021-0500 [DEBUG] plugin: plugin process exited: path="/Users/ethanbower/Downloads/ETH-terraform (2)/CloudFront-API/.terraform/plugins/darwin_amd64/terraform-provider-aws_v1.52.0_x4"
2018/12/18 11:35:51 [TRACE] dag/walk: upstream errored, not walking "provider.aws (close)"
2018/12/18 11:35:51 [TRACE] dag/walk: upstream errored, not walking "meta.count-boundary (count boundary fixup)"
2018/12/18 11:35:51 [TRACE] dag/walk: upstream errored, not walking "root"
2018/12/18 11:35:51 [TRACE] Preserving existing state lineage "9ff94fa3-ae19-96ed-37d7-5c4a703de561"
2018/12/18 11:35:51 [TRACE] Preserving existing state lineage "9ff94fa3-ae19-96ed-37d7-5c4a703de561"
2018/12/18 11:35:51 [TRACE] Preserving existing state lineage "9ff94fa3-ae19-96ed-37d7-5c4a703de561"
2018/12/18 11:35:51 [DEBUG] Uploading remote state to S3: {
  Body: buffer(0xc000941fb0),
  Bucket: "tfgen-us-west-2",
  ContentLength: 24211,
  ContentType: "application/json",
  Key: "accounts/421471939647/ETH/CloudFront-API-Origin/CloudFront-API.tf-state"
}

Panic Output

panic: interface conversion: interface {} is bool, not int

Expected Behavior

The method settings are applied to the specified stage

Actual Behavior

Terraform crashes on the apply with an unexpected EOF error.

Steps to Reproduce

  1. Create an aws_api_gateway_method_settings resource
  2. Include a cache_data_encrypted property in the resource and set it to true
  3. Terraform apply

Important Factoids

None

References

The closest issue I've found to this is https://github.com/terraform-providers/terraform-provider-aws/issues/5791 where it's stated that a fix was pushed out with v1.35 of the provider. As I'm already on a higher version this seems to be a different issue.

bflad commented 5 years ago

Pull request submitted: #7133

bflad commented 5 years ago

The fix for this has been merged and will release with version 1.56.0 of the Terraform AWS provider, likely middle of this week. 👍

ebower12 commented 5 years ago

Awesome, thanks for the help!

bflad commented 5 years ago

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

ghost commented 4 years ago

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!