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.79k stars 9.14k forks source link

S3-replication configuration rules: Error: rpc error: code = Unavailable desc = transport is closing #12480

Closed jlsan92 closed 4 years ago

jlsan92 commented 4 years ago

Community Note

Terraform Version

v0.12.21

Affected Resource(s)

Terraform Configuration Files

module "my-bucket" {
  source  = "terraform-aws-modules/s3-bucket/aws"
  version = "1.5.0"

  bucket = var.my-bucket-name

  replication_configuration = {
    role = "arn:aws:iam::123456789:role/replication-role"

    rules = [{
      id       = "replication"
      status   = "Enabled"
      priority = 1

      destination = {
        bucket        = var.destination-bucket-arn
        storage_class = "GLACIER"
        account_id    = "987654321"
        access_control_translation = {
          owner = "Destination"
        }
      }
    }]
  }
}

Debug Output

Panic Output

 module.my-bucket.aws_s3_bucket.this[0]: Modifying... [id=my-bucket]
 Error: rpc error: code = Canceled desc = context canceled
 Error: rpc error: code = Unavailable desc = transport is closing
 !!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!
 Terraform crashed! This is always indicative of a bug within Terraform.
 A crash log has been placed at "crash.log" relative to your current
 working directory. It would be immensely helpful if you could please
 report the crash with Terraform[1] so that we can fix this.
 When reporting bugs, please include your terraform version. That
 information is available on the first line of crash.log. You can also
 get it by running 'terraform --version' on the command line.
 SECURITY WARNING: the "crash.log" file that was created may contain 
 sensitive information that must be redacted before it is safe to share 
 on the issue tracker.
 [1]: https://github.com/hashicorp/terraform/issues
 !!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!
 panic: interface conversion: interface {} is nil, not map[string]interface {}
 2020-03-19T12:02:01.111Z [DEBUG] plugin.terraform-provider-aws_v2.51.0_x4: 
 2020-03-19T12:02:01.111Z [DEBUG] plugin.terraform-provider-aws_v2.51.0_x4: goroutine 128 [running]:
 2020-03-19T12:02:01.111Z [DEBUG] plugin.terraform-provider-aws_v2.51.0_x4: github.com/terraform-providers/terraform-provider-aws/aws.rulesHash(0x0, 0x0, 0x0)
 2020-03-19T12:02:01.111Z [DEBUG] plugin.terraform-provider-aws_v2.51.0_x4:     /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_s3_bucket.go:2374 +0x8b8
 2020-03-19T12:02:01.111Z [DEBUG] plugin.terraform-provider-aws_v2.51.0_x4: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Set).hash(0xc000e93c20, 0x0, 0x0, 0xc000f00000, 0x0)
 2020-03-19T12:02:01.111Z [DEBUG] plugin.terraform-provider-aws_v2.51.0_x4:     /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/set.go:221 +0x3d
 2020-03-19T12:02:01.111Z [DEBUG] plugin.terraform-provider-aws_v2.51.0_x4: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Set).add(0xc000e93c20, 0x0, 0x0, 0xc000878800, 0x0, 0xc000a81500)
 2020-03-19T12:02:01.111Z [DEBUG] plugin.terraform-provider-aws_v2.51.0_x4:     /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/set.go:198 +0x83
 2020-03-19T12:02:01.111Z [DEBUG] plugin.terraform-provider-aws_v2.51.0_x4: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*ConfigFieldReader).readSet(0xc000d609f0, 0xc000d618f0, 0x3, 0x3, 0xc0008788c0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
 2020-03-19T12:02:01.111Z [DEBUG] plugin.terraform-provider-aws_v2.51.0_x4:     /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/field_reader_config.go:309 +0x329
 2020-03-19T12:02:01.111Z [DEBUG] plugin.terraform-provider-aws_v2.51.0_x4: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*ConfigFieldReader).readField(0xc000d609f0, 0xc000d618f0, 0x3, 0x3, 0xc00007ca01, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
 2020-03-19T12:02:01.111Z [DEBUG] plugin.terraform-provider-aws_v2.51.0_x4:     /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/field_reader_config.go:132 +0x97f
 2020-03-19T12:02:01.111Z [DEBUG] plugin.terraform-provider-aws_v2.51.0_x4: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*nestedConfigFieldReader).ReadField(0xc0005c5e10, 0xc000d618f0, 0x3, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
 2020-03-19T12:02:01.111Z [DEBUG] plugin.terraform-provider-aws_v2.51.0_x4:     /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/field_reader_config.go:352 +0x8e
 2020-03-19T12:02:01.111Z [DEBUG] plugin.terraform-provider-aws_v2.51.0_x4: github.com/hashicorp/terraform-plugin-sdk/helper/schema.readObjectField(0x6156e00, 0xc0005c5e10, 0xc000e93b60, 0x2, 0x2, 0xc000d16600, 0x0, 0x0, 0x0, 0x0, ...)
 2020-03-19T12:02:01.111Z [DEBUG] plugin.terraform-provider-aws_v2.51.0_x4:     /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/field_reader.go:244 +0x1fc
 2020-03-19T12:02:01.111Z [DEBUG] plugin.terraform-provider-aws_v2.51.0_x4: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*ConfigFieldReader).readField(0xc000d609f0, 0xc000e93b60, 0x2, 0x2, 0xc00007ca01, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
 2020-03-19T12:02:01.111Z [DEBUG] plugin.terraform-provider-aws_v2.51.0_x4:     /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/field_reader_config.go:134 +0x8c7
 2020-03-19T12:02:01.111Z [DEBUG] plugin.terraform-provider-aws_v2.51.0_x4: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*nestedConfigFieldReader).ReadField(0xc0005c5e00, 0xc000e93b60, 0x2, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
 2020-03-19T12:02:01.111Z [DEBUG] plugin.terraform-provider-aws_v2.51.0_x4:     /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/field_reader_config.go:352 +0x8e
 2020-03-19T12:02:01.111Z [DEBUG] plugin.terraform-provider-aws_v2.51.0_x4: github.com/hashicorp/terraform-plugin-sdk/helper/schema.readListField(0x6156e00, 0xc0005c5e00, 0xc000885b20, 0x1, 0x1, 0xc000878640, 0x0, 0x0, 0x0, 0x0, ...)
 2020-03-19T12:02:01.111Z [DEBUG] plugin.terraform-provider-aws_v2.51.0_x4:     /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/field_reader.go:211 +0x340
 2020-03-19T12:02:01.111Z [DEBUG] plugin.terraform-provider-aws_v2.51.0_x4: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*ConfigFieldReader).readField(0xc000d609f0, 0xc000885b20, 0x1, 0x1, 0xc0008b6800, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
 2020-03-19T12:02:01.111Z [DEBUG] plugin.terraform-provider-aws_v2.51.0_x4:     /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/field_reader_config.go:128 +0x60f
 2020-03-19T12:02:01.111Z [DEBUG] plugin.terraform-provider-aws_v2.51.0_x4: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*ConfigFieldReader).ReadField(0xc000d609f0, 0xc000885b20, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc0004ff4c0, ...)
 2020-03-19T12:02:01.111Z [DEBUG] plugin.terraform-provider-aws_v2.51.0_x4:     /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/field_reader_config.go:28 +0xae
 2020-03-19T12:02:01.111Z [DEBUG] plugin.terraform-provider-aws_v2.51.0_x4: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*MultiLevelFieldReader).ReadFieldExact(0xc000e93620, 0xc000885b20, 0x1, 0x1, 0x5845b96, 0x6, 0x0, 0x0, 0x0, 0x0, ...)
 2020-03-19T12:02:01.111Z [DEBUG] plugin.terraform-provider-aws_v2.51.0_x4:     /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/field_reader_multi.go:31 +0xd0
 2020-03-19T12:02:01.111Z [DEBUG] plugin.terraform-provider-aws_v2.51.0_x4: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*ResourceData).get(0xc0002f2e00, 0xc000885b20, 0x1, 0x1, 0x12, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
 2020-03-19T12:02:01.111Z [DEBUG] plugin.terraform-provider-aws_v2.51.0_x4:     /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/resource_data.go:540 +0xfa
 2020-03-19T12:02:01.111Z [DEBUG] plugin.terraform-provider-aws_v2.51.0_x4: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*ResourceData).getChange(0xc0002f2e00, 0x58993e2, 0x19, 0xc000e71201, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
 2020-03-19T12:02:01.111Z [DEBUG] plugin.terraform-provider-aws_v2.51.0_x4:     /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/resource_data.go:516 +0x122
 2020-03-19T12:02:01.111Z [DEBUG] plugin.terraform-provider-aws_v2.51.0_x4: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*ResourceData).diffChange(0xc0002f2e00, 0x58993e2, 0x19, 0xc000885a30, 0x0, 0x0, 0x585c6be, 0xc0008a9680)
 2020-03-19T12:02:01.111Z [DEBUG] plugin.terraform-provider-aws_v2.51.0_x4:     /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/resource_data.go:493 +0x97
 2020-03-19T12:02:01.111Z [DEBUG] plugin.terraform-provider-aws_v2.51.0_x4: github.com/hashicorp/terraform-plugin-sdk/helper/schema.schemaMap.diffList(0xc000d16330, 0x58993e2, 0x19, 0xc000878640, 0xc0008cf4b8, 0x6208800, 0xc0002f2e00, 0x42d200, 0x0, 0x0)
 2020-03-19T12:02:01.111Z [DEBUG] plugin.terraform-provider-aws_v2.51.0_x4:     /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/schema.go:958 +0x66
 2020-03-19T12:02:01.111Z [DEBUG] plugin.terraform-provider-aws_v2.51.0_x4: github.com/hashicorp/terraform-plugin-sdk/helper/schema.schemaMap.diff(0xc000d16330, 0x58993e2, 0x19, 0xc000878640, 0xc000e93520, 0x6208800, 0xc0002f2e00, 0xc0008a2000, 0x0, 0x0)
 2020-03-19T12:02:01.111Z [DEBUG] plugin.terraform-provider-aws_v2.51.0_x4:     /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/schema.go:919 +0x464
 2020-03-19T12:02:01.111Z [DEBUG] plugin.terraform-provider-aws_v2.51.0_x4: github.com/hashicorp/terraform-plugin-sdk/helper/schema.schemaMap.Diff(0xc000d16330, 0xc000f1b9a0, 0xc000d41680, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x8020102)
 2020-03-19T12:02:01.111Z [DEBUG] plugin.terraform-provider-aws_v2.51.0_x4:     /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/schema.go:500 +0x215
 2020-03-19T12:02:01.111Z [DEBUG] plugin.terraform-provider-aws_v2.51.0_x4: github.com/hashicorp/terraform-plugin-sdk/helper/schema.diffFromValues(0x61f3960, 0xc0005c4ef8, 0x4bafae0, 0xc000ad28d0, 0x61f3960, 0xc0005c5188, 0x4bafae0, 0xc000cf67e0, 0xc000f0ae00, 0x0, ...)
 2020-03-19T12:02:01.111Z [DEBUG] plugin.terraform-provider-aws_v2.51.0_x4:     /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/shims.go:38 +0x13b
 2020-03-19T12:02:01.111Z [DEBUG] plugin.terraform-provider-aws_v2.51.0_x4: github.com/hashicorp/terraform-plugin-sdk/helper/schema.DiffFromValues(...)
 2020-03-19T12:02:01.111Z [DEBUG] plugin.terraform-provider-aws_v2.51.0_x4:     /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/shims.go:19
 2020-03-19T12:02:01.111Z [DEBUG] plugin.terraform-provider-aws_v2.51.0_x4: github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin.(*GRPCProviderServer).ApplyResourceChange(0xc000602b08, 0x61f2ca0, 0xc000984cf0, 0xc000d52780, 0xc000602b08, 0xc000984cf0, 0xc000a2aa80)
 2020-03-19T12:02:01.111Z [DEBUG] plugin.terraform-provider-aws_v2.51.0_x4:     /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin/grpc_provider.go:838 +0x1135
 2020-03-19T12:02:01.111Z [DEBUG] plugin.terraform-provider-aws_v2.51.0_x4: github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5._Provider_ApplyResourceChange_Handler(0x5708680, 0xc000602b08, 0x61f2ca0, 0xc000984cf0, 0xc000d52720, 0x0, 0x61f2ca0, 0xc000984cf0, 0xc000ceac80, 0xc7f)
 2020-03-19T12:02:01.111Z [DEBUG] plugin.terraform-provider-aws_v2.51.0_x4:     /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5/tfplugin5.pb.go:3189 +0x217
 2020-03-19T12:02:01.111Z [DEBUG] plugin.terraform-provider-aws_v2.51.0_x4: google.golang.org/grpc.(*Server).processUnaryRPC(0xc000402000, 0x6213480, 0xc000547380, 0xc000166a00, 0xc000290c30, 0x95a5060, 0x0, 0x0, 0x0)
 2020-03-19T12:02:01.111Z [DEBUG] plugin.terraform-provider-aws_v2.51.0_x4:     /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/google.golang.org/grpc/server.go:995 +0x460
 2020-03-19T12:02:01.111Z [DEBUG] plugin.terraform-provider-aws_v2.51.0_x4: google.golang.org/grpc.(*Server).handleStream(0xc000402000, 0x6213480, 0xc000547380, 0xc000166a00, 0x0)
 2020-03-19T12:02:01.111Z [DEBUG] plugin.terraform-provider-aws_v2.51.0_x4:     /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/google.golang.org/grpc/server.go:1275 +0xd97
 2020-03-19T12:02:01.111Z [DEBUG] plugin.terraform-provider-aws_v2.51.0_x4: google.golang.org/grpc.(*Server).serveStreams.func1.1(0xc000654280, 0xc000402000, 0x6213480, 0xc000547380, 0xc000166a00)
 2020-03-19T12:02:01.111Z [DEBUG] plugin.terraform-provider-aws_v2.51.0_x4:     /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/google.golang.org/grpc/server.go:710 +0xbb
 2020-03-19T12:02:01.111Z [DEBUG] plugin.terraform-provider-aws_v2.51.0_x4: created by google.golang.org/grpc.(*Server).serveStreams.func1
 2020-03-19T12:02:01.111Z [DEBUG] plugin.terraform-provider-aws_v2.51.0_x4:     /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/google.golang.org/grpc/server.go:708 +0xa1
 2020-03-19T12:02:01.113Z [DEBUG] plugin: plugin process exited: path=/my-path/.terraform/plugins/linux_amd64/terraform-provider-aws_v2.51.0_x4 pid=142 error="exit status 2"
 2020/03/19 12:02:01 [DEBUG] module.my-bucket.aws_s3_bucket.this[0]: apply errored, but we're indicating that via the Error pointer rather than returning it: rpc error: code = Unavailable desc = transport is closing
 2020/03/19 12:02:01 [TRACE] module.my-bucket: eval: *terraform.EvalMaybeTainted
 2020/03/19 12:02:01 [TRACE] module.my-bucket: eval: *terraform.EvalWriteState
 2020/03/19 12:02:01 [TRACE] EvalWriteState: recording 0 dependencies for module.my-bucket.aws_s3_bucket.this[0]
 2020/03/19 12:02:01 [TRACE] EvalWriteState: writing current state object for module.my-bucket.aws_s3_bucket.this[0]
 2020/03/19 12:02:01 [TRACE] module.my-bucket: eval: *terraform.EvalApplyProvisioners
 2020/03/19 12:02:01 [TRACE] EvalApplyProvisioners: aws_s3_bucket.this[0] is not freshly-created, so no provisioning is required
 2020/03/19 12:02:01 [TRACE] module.my-bucket: eval: *terraform.EvalMaybeTainted
 2020/03/19 12:02:01 [TRACE] module.my-bucket: eval: *terraform.EvalWriteState
 2020/03/19 12:02:01 [TRACE] EvalWriteState: recording 0 dependencies for module.my-bucket.aws_s3_bucket.this[0]
 2020/03/19 12:02:01 [TRACE] EvalWriteState: writing current state object for module.my-bucket.aws_s3_bucket.this[0]
 2020/03/19 12:02:01 [TRACE] module.my-bucket: eval: *terraform.EvalIf
 2020/03/19 12:02:01 [TRACE] module.my-bucket: eval: *terraform.EvalIf
 2020/03/19 12:02:01 [TRACE] module.my-bucket: eval: *terraform.EvalWriteDiff
 2020/03/19 12:02:01 [TRACE] module.my-bucket: eval: *terraform.EvalApplyPost
 2020/03/19 12:02:01 [ERROR] module.my-bucket: eval: *terraform.EvalApplyPost, err: rpc error: code = Unavailable desc = transport is closing
 2020/03/19 12:02:01 [ERROR] module.my-bucket: eval: *terraform.EvalSequence, err: rpc error: code = Unavailable desc = transport is closing
 2020/03/19 12:02:01 [TRACE] [walkApply] Exiting eval tree: module.my-bucket.aws_s3_bucket.this[0]
 2020/03/19 12:02:01 [TRACE] vertex "module.my-bucket.aws_s3_bucket.this[0]": visit complete
 2020/03/19 12:02:01 [TRACE] module.my-bucket: eval: *terraform.EvalSequence
 2020/03/19 12:02:01 [TRACE] module.my-bucket: eval: *terraform.EvalGetProvider
 2020/03/19 12:02:01 [TRACE] module.my-bucket: eval: *terraform.EvalReadDiff
 2020/03/19 12:02:01 [TRACE] EvalReadDiff: Read Update change from plan for module.my-bucket.aws_s3_bucket.this[0]
 2020/03/19 12:02:01 [TRACE] module.my-bucket: eval: *terraform.EvalIf
 2020/03/19 12:02:01 [TRACE] module.my-bucket: eval: terraform.EvalNoop
 2020/03/19 12:02:01 [TRACE] module.my-bucket: eval: *terraform.EvalIf
 2020/03/19 12:02:01 [TRACE] module.my-bucket: eval: *terraform.EvalReadState
 2020/03/19 12:02:01 [TRACE] EvalReadState: reading state for module.my-bucket.aws_s3_bucket.this[0]
 2020/03/19 12:02:01 [TRACE] UpgradeResourceState: schema version of module.my-bucket.aws_s3_bucket.this[0] is still 0; calling provider "registry.terraform.io/-/aws" for any other minor fixups
 2020/03/19 12:02:01 [TRACE] GRPCProvider: UpgradeResourceState
 2020/03/19 12:02:01 [ERROR] module.my-bucket: eval: *terraform.EvalReadState, err: rpc error: code = Canceled desc = context canceled
 2020/03/19 12:02:01 [ERROR] module.my-bucket: eval: *terraform.EvalSequence, err: rpc error: code = Canceled desc = context canceled
 2020/03/19 12:02:01 [TRACE] [walkApply] Exiting eval tree: module.my-bucket.aws_s3_bucket.this[0]
 2020/03/19 12:02:01 [TRACE] vertex "module.my-bucket.aws_s3_bucket.this[0]": visit complete
 2020/03/19 12:02:01 [TRACE] dag/walk: upstream of "meta.count-boundary (EachMode fixup)" errored, so skipping
 2020/03/19 12:02:01 [TRACE] dag/walk: upstream of "provider.aws (close)" errored, so skipping
 2020/03/19 12:02:01 [TRACE] dag/walk: upstream of "root" errored, so skipping
 2020/03/19 12:02:01 [DEBUG] Uploading remote state to S3: {
   Body: buffer(0xc0014c71a0),
   Bucket: "my-remote-state-bucket",
   ContentLength: 11590,
   ContentType: "application/json",
   Key: "tfstate",
   ServerSideEncryption: "AES256"
 }
 2020-03-19T12:02:01.330Z [DEBUG] plugin: plugin exited

Expected Behavior

The S3 bucket replication configuration gets updated.

Actual Behavior

Terraform panic crash

Steps to Reproduce

  1. terraform plan to see the weird plan result for replication rules
  2. terraform apply to see the panic error

Important Factoids

Please note that the plan before applying the changes looks weird in terms of replication rules, there's an empty rule config, probably the cause of the crash ⚠️

An execution plan has been generated and is shown below.
 Resource actions are indicated with the following symbols:
   ~ update in-place
 Terraform will perform the following actions:
   # module.my-bucket.aws_s3_bucket.this[0] will be updated in-place
   ~ resource "aws_s3_bucket" "this" {
         acl                         = "private"
         arn                         = "arn:aws:s3:::my-bucket"
         bucket                      = "my-bucket"
         bucket_domain_name          = "my-bucket.s3.amazonaws.com"
         bucket_regional_domain_name = "my-bucket.s3.us-west-1.amazonaws.com"
         force_destroy               = false
         hosted_zone_id              = "XXXXXXXXXXX"
         id                          = "my-bucket"
         region                      = "us-west-1"
         request_payer               = "BucketOwner"
         tags                        = {}
       ~ replication_configuration {
             role = "arn:aws:iam::123456789:role/replication-role"
           + rules {
               + id       = "replication"
               + priority = 1
               + status   = "Enabled"
               + destination {
                   + account_id    = "987654321"
                   + bucket        = "arn:aws:s3:::destination-bucket"
                   + storage_class = "GLACIER"
                   + access_control_translation {
                       + owner = "Destination"
                     }
                 }
             }
           - rules {
               - id       = "replication" -> null
               - priority = 1 -> null
               - status   = "Enabled" -> null
               - destination {
                   - account_id    = "987654321" -> null
                   - bucket        = "arn:aws:s3:::destination-bucket" -> null
                   - storage_class = "GLACIER" -> null
                 }
               - filter {}
             }
           + rules { # why an empty "rules" block?
             }
         }
     }
 Plan: 0 to add, 1 to change, 0 to destroy.

References

ewbankkit commented 4 years ago

This is the crash site:

https://github.com/terraform-providers/terraform-provider-aws/blob/6baa89ca1c43f23dd711bd60ba490b6181b3b9ba/aws/resource_aws_s3_bucket.go#L2372-L2374

bflad commented 4 years ago

Crash fix submitted: https://github.com/terraform-providers/terraform-provider-aws/pull/12614

The underlying plan difference issue with an empty rules configuration block being added is certainly bizarre, but I wasn't able to reproduce it easily. If that is still happening after this fix on the latest version of the Terraform CLI (0.12.24+), its probably worth opening a new bug report with the prior and updated configurations for reproduction. 👍

bflad commented 4 years ago

The fix mentioned above has been merged and will release with version 2.56.0 of the Terraform AWS Provider, later this week. 👍

ghost commented 4 years ago

This has been released in version 2.56.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 for triage. Thanks!

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!