-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
Unable to create S3 buckets on local mocks since 3.0.0 #14427
Comments
Hi @ballwood 👋 Thank you for reporting this and sorry for the trouble. At the moment we don't regularly test against non-AWS implementations, so apologies this was missed, but we certainly would like to provide best effort support for this functionality. Your suggestion about threading through the provider |
Here's an example of a test with Localstack: source, CI, Gradle Build. I'd like to convert it to a go test on s3 resource, but:
|
…r s3manager.GetBucketRegion calls Reference: #14427 Previously on or after 3.0.0: ```terraform terraform { required_providers { aws = "3.0.0" } required_version = "0.12.29" } provider "aws" { region = "eu-west-1" access_key = "fakeKey" secret_key = "fakeKey" s3_force_path_style = true skip_credentials_validation = true skip_metadata_api_check = true skip_requesting_account_id = true endpoints { s3 = "http://localhost:9090" } } resource "aws_s3_bucket" "test" { bucket = "test-bucket" } ``` ```console $ docker run -p 9090:9090 -t adobe/s3mock $ terraform apply ... aws_s3_bucket.test: Creating... aws_s3_bucket.test: Still creating... [10s elapsed] aws_s3_bucket.test: Still creating... [20s elapsed] Error: error getting S3 Bucket location: RequestError: send request failed caused by: dial tcp: lookup test-bucket.localhost on 192.168.1.1:53: no such host on main.tf line 25, in resource "aws_s3_bucket" "test": 25: resource "aws_s3_bucket" "test" { ``` Now: ```console $ terraform apply ... aws_s3_bucket.test: Creating... aws_s3_bucket.test: Creation complete after 0s [id=test-bucket] Apply complete! Resources: 1 added, 0 changed, 0 destroyed. ``` Output from acceptance testing: ``` --- PASS: TestAccAWSS3Bucket_acceleration (53.30s) --- PASS: TestAccAWSS3Bucket_AclToGrant (51.07s) --- PASS: TestAccAWSS3Bucket_basic (31.56s) --- PASS: TestAccAWSS3Bucket_Bucket_EmptyString (31.65s) --- PASS: TestAccAWSS3Bucket_Cors_Delete (25.97s) --- PASS: TestAccAWSS3Bucket_Cors_EmptyOrigin (33.67s) --- PASS: TestAccAWSS3Bucket_Cors_Update (55.10s) --- PASS: TestAccAWSS3Bucket_disableDefaultEncryption_whenDefaultEncryptionIsEnabled (56.01s) --- PASS: TestAccAWSS3Bucket_enableDefaultEncryption_whenAES256IsUsed (31.69s) --- PASS: TestAccAWSS3Bucket_enableDefaultEncryption_whenTypical (38.29s) --- PASS: TestAccAWSS3Bucket_forceDestroy (32.49s) --- PASS: TestAccAWSS3Bucket_forceDestroyWithEmptyPrefixes (29.00s) --- PASS: TestAccAWSS3Bucket_forceDestroyWithObjectLockEnabled (31.61s) --- PASS: TestAccAWSS3Bucket_generatedName (30.69s) --- PASS: TestAccAWSS3Bucket_GrantToAcl (48.35s) --- PASS: TestAccAWSS3Bucket_LifecycleBasic (79.24s) --- PASS: TestAccAWSS3Bucket_LifecycleExpireMarkerOnly (52.70s) --- PASS: TestAccAWSS3Bucket_LifecycleRule_Expiration_EmptyConfigurationBlock (25.59s) --- PASS: TestAccAWSS3Bucket_Logging (50.13s) --- PASS: TestAccAWSS3Bucket_namePrefix (30.79s) --- PASS: TestAccAWSS3Bucket_objectLock (54.26s) --- PASS: TestAccAWSS3Bucket_Policy (73.69s) --- PASS: TestAccAWSS3Bucket_Replication (111.61s) --- PASS: TestAccAWSS3Bucket_ReplicationConfiguration_Rule_Destination_AccessControlTranslation (66.43s) --- PASS: TestAccAWSS3Bucket_ReplicationConfiguration_Rule_Destination_AddAccessControlTranslation (64.58s) --- PASS: TestAccAWSS3Bucket_ReplicationExpectVersioningValidationError (19.21s) --- PASS: TestAccAWSS3Bucket_ReplicationSchemaV2 (114.21s) --- PASS: TestAccAWSS3Bucket_ReplicationWithoutPrefix (38.67s) --- PASS: TestAccAWSS3Bucket_ReplicationWithoutStorageClass (39.78s) --- PASS: TestAccAWSS3Bucket_RequestPayer (56.71s) --- PASS: TestAccAWSS3Bucket_SameRegionReplicationSchemaV2 (51.20s) --- PASS: TestAccAWSS3Bucket_shouldFailNotFound (12.38s) --- PASS: TestAccAWSS3Bucket_tagsWithNoSystemTags (99.87s) --- PASS: TestAccAWSS3Bucket_tagsWithSystemTags (148.81s) --- PASS: TestAccAWSS3Bucket_UpdateAcl (50.58s) --- PASS: TestAccAWSS3Bucket_UpdateGrant (80.43s) --- PASS: TestAccAWSS3Bucket_Versioning (77.33s) --- PASS: TestAccAWSS3Bucket_Website_Simple (79.51s) --- PASS: TestAccAWSS3Bucket_WebsiteRedirect (79.03s) --- PASS: TestAccAWSS3Bucket_WebsiteRoutingRules (55.56s) --- PASS: TestAccDataSourceS3Bucket_basic (28.96s) --- PASS: TestAccDataSourceS3Bucket_website (29.28s) ```
@artamonovkirill you are not missing anything at the moment. 😅 Our acceptance testing framework expects that endpoints are running before testing begins and that configurations can be provided via environment variables, so we do not typically run our acceptance test against non-production AWS endpoints, such as Localstack, s3mock, etc. at the moment. We still list non-AWS implementations as best effort support due to maintainer team size and I'm not sure we have the bandwidth to change that position for now, even if submissions were made to enable that type of testing via Makefile targets and customized test configurations, etc. Since we would like to fix this regression shortly though, please note that the fix has been submitted to passthrough the provider |
…r s3manager.GetBucketRegion calls (#14481) Reference: #14427 Previously on or after 3.0.0: ```terraform terraform { required_providers { aws = "3.0.0" } required_version = "0.12.29" } provider "aws" { region = "eu-west-1" access_key = "fakeKey" secret_key = "fakeKey" s3_force_path_style = true skip_credentials_validation = true skip_metadata_api_check = true skip_requesting_account_id = true endpoints { s3 = "http://localhost:9090" } } resource "aws_s3_bucket" "test" { bucket = "test-bucket" } ``` ```console $ docker run -p 9090:9090 -t adobe/s3mock $ terraform apply ... aws_s3_bucket.test: Creating... aws_s3_bucket.test: Still creating... [10s elapsed] aws_s3_bucket.test: Still creating... [20s elapsed] Error: error getting S3 Bucket location: RequestError: send request failed caused by: dial tcp: lookup test-bucket.localhost on 192.168.1.1:53: no such host on main.tf line 25, in resource "aws_s3_bucket" "test": 25: resource "aws_s3_bucket" "test" { ``` Now: ```console $ terraform apply ... aws_s3_bucket.test: Creating... aws_s3_bucket.test: Creation complete after 0s [id=test-bucket] Apply complete! Resources: 1 added, 0 changed, 0 destroyed. ``` Output from acceptance testing: ``` --- PASS: TestAccAWSS3Bucket_acceleration (53.30s) --- PASS: TestAccAWSS3Bucket_AclToGrant (51.07s) --- PASS: TestAccAWSS3Bucket_basic (31.56s) --- PASS: TestAccAWSS3Bucket_Bucket_EmptyString (31.65s) --- PASS: TestAccAWSS3Bucket_Cors_Delete (25.97s) --- PASS: TestAccAWSS3Bucket_Cors_EmptyOrigin (33.67s) --- PASS: TestAccAWSS3Bucket_Cors_Update (55.10s) --- PASS: TestAccAWSS3Bucket_disableDefaultEncryption_whenDefaultEncryptionIsEnabled (56.01s) --- PASS: TestAccAWSS3Bucket_enableDefaultEncryption_whenAES256IsUsed (31.69s) --- PASS: TestAccAWSS3Bucket_enableDefaultEncryption_whenTypical (38.29s) --- PASS: TestAccAWSS3Bucket_forceDestroy (32.49s) --- PASS: TestAccAWSS3Bucket_forceDestroyWithEmptyPrefixes (29.00s) --- PASS: TestAccAWSS3Bucket_forceDestroyWithObjectLockEnabled (31.61s) --- PASS: TestAccAWSS3Bucket_generatedName (30.69s) --- PASS: TestAccAWSS3Bucket_GrantToAcl (48.35s) --- PASS: TestAccAWSS3Bucket_LifecycleBasic (79.24s) --- PASS: TestAccAWSS3Bucket_LifecycleExpireMarkerOnly (52.70s) --- PASS: TestAccAWSS3Bucket_LifecycleRule_Expiration_EmptyConfigurationBlock (25.59s) --- PASS: TestAccAWSS3Bucket_Logging (50.13s) --- PASS: TestAccAWSS3Bucket_namePrefix (30.79s) --- PASS: TestAccAWSS3Bucket_objectLock (54.26s) --- PASS: TestAccAWSS3Bucket_Policy (73.69s) --- PASS: TestAccAWSS3Bucket_Replication (111.61s) --- PASS: TestAccAWSS3Bucket_ReplicationConfiguration_Rule_Destination_AccessControlTranslation (66.43s) --- PASS: TestAccAWSS3Bucket_ReplicationConfiguration_Rule_Destination_AddAccessControlTranslation (64.58s) --- PASS: TestAccAWSS3Bucket_ReplicationExpectVersioningValidationError (19.21s) --- PASS: TestAccAWSS3Bucket_ReplicationSchemaV2 (114.21s) --- PASS: TestAccAWSS3Bucket_ReplicationWithoutPrefix (38.67s) --- PASS: TestAccAWSS3Bucket_ReplicationWithoutStorageClass (39.78s) --- PASS: TestAccAWSS3Bucket_RequestPayer (56.71s) --- PASS: TestAccAWSS3Bucket_SameRegionReplicationSchemaV2 (51.20s) --- PASS: TestAccAWSS3Bucket_shouldFailNotFound (12.38s) --- PASS: TestAccAWSS3Bucket_tagsWithNoSystemTags (99.87s) --- PASS: TestAccAWSS3Bucket_tagsWithSystemTags (148.81s) --- PASS: TestAccAWSS3Bucket_UpdateAcl (50.58s) --- PASS: TestAccAWSS3Bucket_UpdateGrant (80.43s) --- PASS: TestAccAWSS3Bucket_Versioning (77.33s) --- PASS: TestAccAWSS3Bucket_Website_Simple (79.51s) --- PASS: TestAccAWSS3Bucket_WebsiteRedirect (79.03s) --- PASS: TestAccAWSS3Bucket_WebsiteRoutingRules (55.56s) --- PASS: TestAccDataSourceS3Bucket_basic (28.96s) --- PASS: TestAccDataSourceS3Bucket_website (29.28s) ```
The fix for this (passing through the provider |
@bflad , thanks! 👍 |
@bflad thanks for sorting this so promptly, appreciate it |
This has been released in version 3.1.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! |
@bflad , I'm still getting an error with 3.1.0 - a different one, though: Are there other occurrences in the code where |
@artamonovkirill I think filing a separate bug report with the relevant details (e.g. what service/tooling you are using) is the most appropriate action in that case. Please do note here that the maintainers cannot guarantee full compatibility with all non-AWS tooling if they do not implement the S3 APIs correctly. |
@bflad, thanks for the support. |
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! |
Community Note
Terraform CLI and Terraform AWS Provider Version
Affected Resource(s)
Terraform Configuration Files
Debug Output
Panic Output
Expected Behavior
Bucket should have been created on s3 mock
Actual Behavior
Error: error getting S3 Bucket location: RequestError: send request failed caused by: dial tcp: lookup test-bucket.localhost on 192.168.1.1:53: no such host
Steps to Reproduce
docker run -p 9090:9090 -t adobe/s3mock
terraform apply
Important Factoids
aws.Bool(false)
being set to false here rather than respectings3_force_path_style = true
in the providerReferences
The text was updated successfully, but these errors were encountered: