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
Comments
Looks like the error was in the way I was defaulting the bucket expiration. My shared module was configured with
And my
Why It didn't work, so now I'm using this:
That works ;) It would be nice to have a more obvious error message, though, so I'll leave the issue open. |
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: 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. |
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:
|
@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"
}
} |
…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) ```
…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) ```
The fix mentioned above has been merged and will release with version 2.56.0 of the Terraform AWS Provider, later this week. 👍 |
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! |
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! |
Terraform Version
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
Panic Output
Steps to Reproduce
terraform apply
References
The text was updated successfully, but these errors were encountered: