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

Error: rpc error: code = Unavailable desc = transport is closing (interface conversion panic) #11420

Closed
claudiobizzotto opened this issue Dec 24, 2019 · 8 comments · Fixed by #12614
Assignees
Labels
bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic. service/s3 Issues and PRs that pertain to the s3 service.
Milestone

Comments

@claudiobizzotto
Copy link

Terraform Version

Terraform v0.12.18
+ provider.aws v2.43.0
+ provider.template v2.1.2

Affected Resource(s)

s3_bucket defined in a custom Terraform module.

Terraform Configuration Files

Can't share template, but I can say it makes use of a Terraform module that defines an S3 bucket resource.

Debug Output

Error: rpc error: code = Unavailable desc = transport is closing

Panic Output

2019-12-24T12:24:05.785-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: panic: interface conversion: interface {} is nil, not map[string]interface {}
2019-12-24T12:24:05.785-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: 
2019-12-24T12:24:05.785-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: goroutine 64 [running]:
2019-12-24T12:24:05.785-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: github.com/terraform-providers/terraform-provider-aws/aws.expirationHash(0x0, 0x0, 0x1)
2019-12-24T12:24:05.785-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_s3_bucket.go:2312 +0x3d6
2019-12-24T12:24:05.785-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Set).hash(0xc000b5a5e0, 0x0, 0x0, 0x746172697078652e, 0x2e302e6e6f69)
2019-12-24T12:24:05.785-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-sdk@v1.4.1/helper/schema/set.go:221 +0x3d
2019-12-24T12:24:05.785-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Set).add(0xc000b5a5e0, 0x0, 0x0, 0xc0006b3700, 0x0, 0xc000b19080)
2019-12-24T12:24:05.785-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-sdk@v1.4.1/helper/schema/set.go:198 +0x83
2019-12-24T12:24:05.785-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*ConfigFieldReader).readSet(0xc000b4ef60, 0xc000b4f950, 0x3, 0x3, 0xc0006b37c0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
2019-12-24T12:24:05.785-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-sdk@v1.4.1/helper/schema/field_reader_config.go:309 +0x329
2019-12-24T12:24:05.785-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*ConfigFieldReader).readField(0xc000b4ef60, 0xc000b4f950, 0x3, 0x3, 0xc000088801, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
2019-12-24T12:24:05.785-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-sdk@v1.4.1/helper/schema/field_reader_config.go:132 +0x97f
2019-12-24T12:24:05.785-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*nestedConfigFieldReader).ReadField(0xc00000fac0, 0xc000b4f950, 0x3, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
2019-12-24T12:24:05.785-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-sdk@v1.4.1/helper/schema/field_reader_config.go:352 +0x8e
2019-12-24T12:24:05.785-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: github.com/hashicorp/terraform-plugin-sdk/helper/schema.readObjectField(0x66d9b20, 0xc00000fac0, 0xc000b5a4e0, 0x2, 0x2, 0xc00068d110, 0x0, 0x0, 0x0, 0x0, ...)
2019-12-24T12:24:05.785-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-sdk@v1.4.1/helper/schema/field_reader.go:244 +0x1fc
2019-12-24T12:24:05.786-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*ConfigFieldReader).readField(0xc000b4ef60, 0xc000b5a4e0, 0x2, 0x2, 0xc000088801, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
2019-12-24T12:24:05.786-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-sdk@v1.4.1/helper/schema/field_reader_config.go:134 +0x8c7
2019-12-24T12:24:05.786-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*nestedConfigFieldReader).ReadField(0xc00000fab0, 0xc000b5a4e0, 0x2, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
2019-12-24T12:24:05.786-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-sdk@v1.4.1/helper/schema/field_reader_config.go:352 +0x8e
2019-12-24T12:24:05.786-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: github.com/hashicorp/terraform-plugin-sdk/helper/schema.readListField(0x66d9b20, 0xc00000fab0, 0xc000b54ec0, 0x1, 0x1, 0xc0006b4500, 0x0, 0x0, 0x0, 0x0, ...)
2019-12-24T12:24:05.786-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-sdk@v1.4.1/helper/schema/field_reader.go:211 +0x340
2019-12-24T12:24:05.786-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*ConfigFieldReader).readField(0xc000b4ef60, 0xc000b54ec0, 0x1, 0x1, 0xc000b5a400, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
2019-12-24T12:24:05.786-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-sdk@v1.4.1/helper/schema/field_reader_config.go:128 +0x60f
2019-12-24T12:24:05.786-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*ConfigFieldReader).ReadField(0xc000b4ef60, 0xc000b54ec0, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x95005d8, ...)
2019-12-24T12:24:05.786-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-sdk@v1.4.1/helper/schema/field_reader_config.go:28 +0xae
2019-12-24T12:24:05.786-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*MultiLevelFieldReader).ReadFieldExact(0xc00091fcc0, 0xc000b54ec0, 0x1, 0x1, 0x5e734c6, 0x6, 0x0, 0x0, 0x0, 0x0, ...)
2019-12-24T12:24:05.786-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-sdk@v1.4.1/helper/schema/field_reader_multi.go:31 +0xd0
2019-12-24T12:24:05.786-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*ResourceData).get(0xc0001502a0, 0xc000b54ec0, 0x1, 0x1, 0x12, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
2019-12-24T12:24:05.786-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-sdk@v1.4.1/helper/schema/resource_data.go:534 +0xfa
2019-12-24T12:24:05.786-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*ResourceData).getChange(0xc0001502a0, 0x5e8a03b, 0xe, 0xc000921201, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
2019-12-24T12:24:05.786-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-sdk@v1.4.1/helper/schema/resource_data.go:510 +0x122
2019-12-24T12:24:05.786-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*ResourceData).diffChange(0xc0001502a0, 0x5e8a03b, 0xe, 0xc0006b2640, 0xc0009273e8, 0x67885c0, 0xc0001502a0, 0x1000000)
2019-12-24T12:24:05.786-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-sdk@v1.4.1/helper/schema/resource_data.go:487 +0x97
2019-12-24T12:24:05.787-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: github.com/hashicorp/terraform-plugin-sdk/helper/schema.schemaMap.diffList(0xc00068cff0, 0x5e8a03b, 0xe, 0xc0006b4500, 0xc0009273e8, 0x67885c0, 0xc0001502a0, 0x102cc00, 0x0, 0x0)
2019-12-24T12:24:05.787-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-sdk@v1.4.1/helper/schema/schema.go:958 +0x66
2019-12-24T12:24:05.787-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: github.com/hashicorp/terraform-plugin-sdk/helper/schema.schemaMap.diff(0xc00068cff0, 0x5e8a03b, 0xe, 0xc0006b4500, 0xc00091fbc0, 0x67885c0, 0xc0001502a0, 0x6718100, 0x0, 0x0)
2019-12-24T12:24:05.787-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-sdk@v1.4.1/helper/schema/schema.go:919 +0x464
2019-12-24T12:24:05.787-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: github.com/hashicorp/terraform-plugin-sdk/helper/schema.schemaMap.Diff(0xc00068cff0, 0xc000910460, 0xc000b4e420, 0x0, 0x4d195e0, 0xc0002e4500, 0x6773600, 0xc0008a6340, 0xffffffffffffffff, 0x0)
2019-12-24T12:24:05.787-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-sdk@v1.4.1/helper/schema/schema.go:500 +0x215
2019-12-24T12:24:05.787-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Resource).simpleDiff(0xc0006a5b80, 0xc000910460, 0xc000b4e420, 0x4d195e0, 0xc0002e4500, 0xc000b4e401, 0xc000927790, 0x100d0ed)
2019-12-24T12:24:05.787-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-sdk@v1.4.1/helper/schema/resource.go:351 +0x85
2019-12-24T12:24:05.787-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Provider).SimpleDiff(0xc0007af000, 0xc000927978, 0xc000910460, 0xc000b4e420, 0xc00090c1a0, 0xc000b4e420, 0x0)
2019-12-24T12:24:05.787-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-sdk@v1.4.1/helper/schema/provider.go:321 +0x99
2019-12-24T12:24:05.787-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin.(*GRPCProviderServer).PlanResourceChange(0xc00000f340, 0x6772a80, 0xc0009a2930, 0xc000aca720, 0xc00000f340, 0xc0009a2930, 0xc000851a80)
2019-12-24T12:24:05.787-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-sdk@v1.4.1/internal/helper/plugin/grpc_provider.go:633 +0x765
2019-12-24T12:24:05.787-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5._Provider_PlanResourceChange_Handler(0x5d3b160, 0xc00000f340, 0x6772a80, 0xc0009a2930, 0xc000aca6c0, 0x0, 0x6772a80, 0xc0009a2930, 0xc000b10e00, 0x6c6)
2019-12-24T12:24:05.787-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-sdk@v1.4.1/internal/tfplugin5/tfplugin5.pb.go:3171 +0x217
2019-12-24T12:24:05.787-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: google.golang.org/grpc.(*Server).processUnaryRPC(0xc0003c2000, 0x6793e40, 0xc000550780, 0xc0004e8100, 0xc0007ad170, 0x94d44e8, 0x0, 0x0, 0x0)
2019-12-24T12:24:05.787-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/google.golang.org/grpc@v1.23.0/server.go:995 +0x460
2019-12-24T12:24:05.787-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: google.golang.org/grpc.(*Server).handleStream(0xc0003c2000, 0x6793e40, 0xc000550780, 0xc0004e8100, 0x0)
2019-12-24T12:24:05.787-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/google.golang.org/grpc@v1.23.0/server.go:1275 +0xd97
2019-12-24T12:24:05.787-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: google.golang.org/grpc.(*Server).serveStreams.func1.1(0xc0001206d0, 0xc0003c2000, 0x6793e40, 0xc000550780, 0xc0004e8100)
2019-12-24T12:24:05.787-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/google.golang.org/grpc@v1.23.0/server.go:710 +0xbb
2019-12-24T12:24:05.787-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: created by google.golang.org/grpc.(*Server).serveStreams.func1
2019-12-24T12:24:05.787-0500 [DEBUG] plugin.terraform-provider-aws_v2.43.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/google.golang.org/grpc@v1.23.0/server.go:708 +0xa1

Steps to Reproduce

terraform apply

References

@ghost ghost added bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic. labels Dec 24, 2019
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Dec 24, 2019
@claudiobizzotto
Copy link
Author

claudiobizzotto commented Dec 24, 2019

Looks like the error was in the way I was defaulting the bucket expiration. My shared module was configured with

expiration {
  days = var.days_before_expiration
}

And my vars.tf had this:

variable "days_before_expiration" {
  description = "Days before objects are permanently deleted."
  type        = number
  default     = null
}

Why null and not 0? Because I was hoping that, by passing that variable as null, the final resource would ignore the expiration block entirely, giving me the option of not setting the expiration for some buckets.

It didn't work, so now I'm using this:

variable "days_before_expiration" {
  description = "Days before objects are permanently deleted."
  type        = number
  default     = 36500 # 100 years
}

That works ;)

It would be nice to have a more obvious error message, though, so I'll leave the issue open.

@bflad bflad added service/s3 Issues and PRs that pertain to the s3 service. and removed needs-triage Waiting for first response or review from a maintainer. labels Jan 2, 2020
@bflad
Copy link
Member

bflad commented Jan 2, 2020

The cause for the panic within the code is not verifying the passed in object is the expected type before performing the type assertion here:

https://github.com/terraform-providers/terraform-provider-aws/blob/b6d453f73fc978ce900198f13df646b13e4717ac/aws/resource_aws_s3_bucket.go#L2312

We likely want to be defensive for this and the other hash functions in this resource with the same issue by using the second return value for Go type assertions and exiting early if it does not match, e.g.

m, ok := v.(map[string]interface{})
if !ok {
  return 0
}

This will only prevent the panic here though -- further handling of the empty configuration block may cause another panic or Terraform displaying a permanent difference in the existence of the configuration block (e.g. .expiration.# 0 => 1).

@lyle-partsavatar
Copy link

lyle-partsavatar commented Feb 4, 2020

I seem to be having a similar problem. I'm trying to create a Cloudfront configuration. I'm using IntelliJ which provides autocomplete for required HCL attributes, and my code looks like this:

  enabled = true
  default_cache_behavior {
    allowed_methods = ["DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT"]
    cached_methods = ["GET", "HEAD"]
    target_origin_id = "*"
    viewer_protocol_policy = "redirect-to-https"
    forwarded_values {
      query_string = false
      cookies {
        forward = "all"
      }
    }
  }
  origin {
    domain_name = var.alb_domain_name
    origin_id = "<ALB_NAME>"
  viewer_certificate {}

    custom_header {
      name = "<HEADER_NAME>"
      value = <HEADER_VAL>
    }
  }
  restrictions {
    geo_restriction {
      restriction_type = ""
    }
  }
}

I'm getting the above error when I try to `terraform apply`.  If I remove that code then everything works.

@timrourke
Copy link

@lyle-partsavatar I ran into the same issue, in my case I was able to get things working again by changing this:

  restrictions {
    geo_restriction {
      restriction_type = ""
    }
  }

...to this:

  restrictions {
    geo_restriction {
      restriction_type = "none"
    }
  }

bflad added a commit that referenced this issue Apr 1, 2020
…on blocks

Reference: #11420
Reference: #12480

This does not contain a fully reproducible configuration for #12480 after a few timeboxed attempts, but left a test that adds `access_control_translation` since that most closely mimics what was reported and was previously untested. The addition of an empty configuration block in the plan difference appears to be a bug in the Terraform Plugin SDK or Terraform core logic.

If/when these various S3 configurations are potentially moved to their own resources, we should try to remove the Set hashing functions then. Generally they are unnecessary except in specific situations.

Previously:

```
=== CONT  TestAccAWSS3Bucket_LifecycleRule_Expiration_EmptyConfigurationBlock
panic: interface conversion: interface {} is nil, not map[string]interface {}

goroutine 228 [running]:
github.com/terraform-providers/terraform-provider-aws/aws.expirationHash(0x0, 0x0, 0xc000e4bf10)
	/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_s3_bucket.go:2503 +0x3d6
github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Set).hash(0xc000e4bf00, 0x0, 0x0, 0x746172697078652e, 0x2e302e6e6f69)
	/Users/bflad/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk@v1.8.0/helper/schema/set.go:221 +0x3d
```

Output from acceptance testing:

```
--- PASS: TestAccAWSS3Bucket_acceleration (62.39s)
--- PASS: TestAccAWSS3Bucket_AclToGrant (62.44s)
--- PASS: TestAccAWSS3Bucket_basic (37.44s)
--- PASS: TestAccAWSS3Bucket_Bucket_EmptyString (35.25s)
--- PASS: TestAccAWSS3Bucket_Cors_Delete (30.46s)
--- PASS: TestAccAWSS3Bucket_Cors_EmptyOrigin (37.46s)
--- PASS: TestAccAWSS3Bucket_Cors_Update (64.62s)
--- PASS: TestAccAWSS3Bucket_disableDefaultEncryption_whenDefaultEncryptionIsEnabled (62.63s)
--- PASS: TestAccAWSS3Bucket_enableDefaultEncryption_whenAES256IsUsed (36.77s)
--- PASS: TestAccAWSS3Bucket_enableDefaultEncryption_whenTypical (64.54s)
--- PASS: TestAccAWSS3Bucket_forceDestroy (34.28s)
--- PASS: TestAccAWSS3Bucket_forceDestroyWithEmptyPrefixes (33.82s)
--- PASS: TestAccAWSS3Bucket_forceDestroyWithObjectLockEnabled (40.74s)
--- PASS: TestAccAWSS3Bucket_generatedName (34.28s)
--- PASS: TestAccAWSS3Bucket_GrantToAcl (55.10s)
--- PASS: TestAccAWSS3Bucket_LifecycleBasic (85.90s)
--- PASS: TestAccAWSS3Bucket_LifecycleExpireMarkerOnly (60.69s)
--- PASS: TestAccAWSS3Bucket_LifecycleRule_Expiration_EmptyConfigurationBlock (29.75s)
--- PASS: TestAccAWSS3Bucket_Logging (53.50s)
--- PASS: TestAccAWSS3Bucket_namePrefix (34.09s)
--- PASS: TestAccAWSS3Bucket_objectLock (61.56s)
--- PASS: TestAccAWSS3Bucket_Policy (88.91s)
--- PASS: TestAccAWSS3Bucket_region (35.91s)
--- PASS: TestAccAWSS3Bucket_Replication (173.40s)
--- PASS: TestAccAWSS3Bucket_ReplicationConfiguration_Rule_Destination_AccessControlTranslation (109.21s)
--- PASS: TestAccAWSS3Bucket_ReplicationConfiguration_Rule_Destination_AddAccessControlTranslation (87.98s)
--- PASS: TestAccAWSS3Bucket_ReplicationExpectVersioningValidationError (27.38s)
--- PASS: TestAccAWSS3Bucket_ReplicationSchemaV2 (150.14s)
--- PASS: TestAccAWSS3Bucket_ReplicationWithoutPrefix (51.20s)
--- PASS: TestAccAWSS3Bucket_ReplicationWithoutStorageClass (51.04s)
--- PASS: TestAccAWSS3Bucket_RequestPayer (61.18s)
--- PASS: TestAccAWSS3Bucket_shouldFailNotFound (17.00s)
--- PASS: TestAccAWSS3Bucket_tagsWithNoSystemTags (114.98s)
--- PASS: TestAccAWSS3Bucket_tagsWithSystemTags (148.05s)
--- PASS: TestAccAWSS3Bucket_UpdateAcl (60.53s)
--- PASS: TestAccAWSS3Bucket_UpdateGrant (90.89s)
--- PASS: TestAccAWSS3Bucket_Versioning (89.97s)
--- PASS: TestAccAWSS3Bucket_Website_Simple (89.17s)
--- PASS: TestAccAWSS3Bucket_WebsiteRedirect (89.72s)
--- PASS: TestAccAWSS3Bucket_WebsiteRoutingRules (63.15s)
```
@bflad bflad self-assigned this Apr 1, 2020
@bflad
Copy link
Member

bflad commented Apr 1, 2020

Crash fix for original report with aws_s3_bucket resource submitted here: #12614

The aws_cloudfront_distribution resource panic is likely related, but separate code, and can be tracked in this issue: #10668

bflad added a commit that referenced this issue Apr 1, 2020
…on blocks (#12614)

Reference: #11420
Reference: #12480

This does not contain a fully reproducible configuration for #12480 after a few timeboxed attempts, but left a test that adds `access_control_translation` since that most closely mimics what was reported and was previously untested. The addition of an empty configuration block in the plan difference appears to be a bug in the Terraform Plugin SDK or Terraform core logic.

If/when these various S3 configurations are potentially moved to their own resources, we should try to remove the Set hashing functions then. Generally they are unnecessary except in specific situations.

Previously:

```
=== CONT  TestAccAWSS3Bucket_LifecycleRule_Expiration_EmptyConfigurationBlock
panic: interface conversion: interface {} is nil, not map[string]interface {}

goroutine 228 [running]:
github.com/terraform-providers/terraform-provider-aws/aws.expirationHash(0x0, 0x0, 0xc000e4bf10)
	/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_s3_bucket.go:2503 +0x3d6
github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Set).hash(0xc000e4bf00, 0x0, 0x0, 0x746172697078652e, 0x2e302e6e6f69)
	/Users/bflad/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk@v1.8.0/helper/schema/set.go:221 +0x3d
```

Output from acceptance testing:

```
--- PASS: TestAccAWSS3Bucket_acceleration (62.39s)
--- PASS: TestAccAWSS3Bucket_AclToGrant (62.44s)
--- PASS: TestAccAWSS3Bucket_basic (37.44s)
--- PASS: TestAccAWSS3Bucket_Bucket_EmptyString (35.25s)
--- PASS: TestAccAWSS3Bucket_Cors_Delete (30.46s)
--- PASS: TestAccAWSS3Bucket_Cors_EmptyOrigin (37.46s)
--- PASS: TestAccAWSS3Bucket_Cors_Update (64.62s)
--- PASS: TestAccAWSS3Bucket_disableDefaultEncryption_whenDefaultEncryptionIsEnabled (62.63s)
--- PASS: TestAccAWSS3Bucket_enableDefaultEncryption_whenAES256IsUsed (36.77s)
--- PASS: TestAccAWSS3Bucket_enableDefaultEncryption_whenTypical (64.54s)
--- PASS: TestAccAWSS3Bucket_forceDestroy (34.28s)
--- PASS: TestAccAWSS3Bucket_forceDestroyWithEmptyPrefixes (33.82s)
--- PASS: TestAccAWSS3Bucket_forceDestroyWithObjectLockEnabled (40.74s)
--- PASS: TestAccAWSS3Bucket_generatedName (34.28s)
--- PASS: TestAccAWSS3Bucket_GrantToAcl (55.10s)
--- PASS: TestAccAWSS3Bucket_LifecycleBasic (85.90s)
--- PASS: TestAccAWSS3Bucket_LifecycleExpireMarkerOnly (60.69s)
--- PASS: TestAccAWSS3Bucket_LifecycleRule_Expiration_EmptyConfigurationBlock (29.75s)
--- PASS: TestAccAWSS3Bucket_Logging (53.50s)
--- PASS: TestAccAWSS3Bucket_namePrefix (34.09s)
--- PASS: TestAccAWSS3Bucket_objectLock (61.56s)
--- PASS: TestAccAWSS3Bucket_Policy (88.91s)
--- PASS: TestAccAWSS3Bucket_region (35.91s)
--- PASS: TestAccAWSS3Bucket_Replication (173.40s)
--- PASS: TestAccAWSS3Bucket_ReplicationConfiguration_Rule_Destination_AccessControlTranslation (109.21s)
--- PASS: TestAccAWSS3Bucket_ReplicationConfiguration_Rule_Destination_AddAccessControlTranslation (87.98s)
--- PASS: TestAccAWSS3Bucket_ReplicationExpectVersioningValidationError (27.38s)
--- PASS: TestAccAWSS3Bucket_ReplicationSchemaV2 (150.14s)
--- PASS: TestAccAWSS3Bucket_ReplicationWithoutPrefix (51.20s)
--- PASS: TestAccAWSS3Bucket_ReplicationWithoutStorageClass (51.04s)
--- PASS: TestAccAWSS3Bucket_RequestPayer (61.18s)
--- PASS: TestAccAWSS3Bucket_shouldFailNotFound (17.00s)
--- PASS: TestAccAWSS3Bucket_tagsWithNoSystemTags (114.98s)
--- PASS: TestAccAWSS3Bucket_tagsWithSystemTags (148.05s)
--- PASS: TestAccAWSS3Bucket_UpdateAcl (60.53s)
--- PASS: TestAccAWSS3Bucket_UpdateGrant (90.89s)
--- PASS: TestAccAWSS3Bucket_Versioning (89.97s)
--- PASS: TestAccAWSS3Bucket_Website_Simple (89.17s)
--- PASS: TestAccAWSS3Bucket_WebsiteRedirect (89.72s)
--- PASS: TestAccAWSS3Bucket_WebsiteRoutingRules (63.15s)
```
@bflad bflad added this to the v2.56.0 milestone Apr 1, 2020
@bflad
Copy link
Member

bflad commented Apr 1, 2020

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

@ghost
Copy link

ghost commented Apr 3, 2020

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
Copy link

ghost commented May 2, 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!

@hashicorp hashicorp locked and limited conversation to collaborators May 2, 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. crash Results from or addresses a Terraform crash or kernel panic. service/s3 Issues and PRs that pertain to the s3 service.
Projects
None yet
4 participants