Having issues deploying s3 bucket to localstack using terraform when using docker
Docker command to run localstack
docker run -it -p 4567-4578:4567-4578 -p 8080:8080 --expose 4572 atlassianlabs/localstack
Terraform script:
provider "aws" {
access_key = "mock_access_key"
region = "us-east-1"
s3_force_path_style = true
secret_key = "mock_secret_key"
skip_credentials_validation = true
skip_metadata_api_check = true
skip_requesting_account_id = true
endpoints {
s3 = "http://0.0.0.0:4572"
}
}
resource "aws_s3_bucket" "testBucket" {
bucket = "myBucket"
acl = "private"
}
After running terraform init terraform plan terraform apply, I get the following error
aws_s3_bucket.testBucket: Refreshing state... [id=myBucket]
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# aws_s3_bucket.testBucket will be created
+ resource "aws_s3_bucket" "testBucket" {
+ acceleration_status = (known after apply)
+ acl = "private"
+ arn = (known after apply)
+ bucket = "myBucket"
+ bucket_domain_name = (known after apply)
+ bucket_regional_domain_name = (known after apply)
+ force_destroy = false
+ hosted_zone_id = (known after apply)
+ id = (known after apply)
+ region = (known after apply)
+ request_payer = (known after apply)
+ website_domain = (known after apply)
+ website_endpoint = (known after apply)
+ versioning {
+ enabled = (known after apply)
+ mfa_delete = (known after apply)
}
}
Plan: 1 to add, 0 to change, 0 to destroy.
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value: yes
aws_s3_bucket.testBucket: Creating...
aws_s3_bucket.testBucket: Still creating... [10s elapsed]
aws_s3_bucket.testBucket: Still creating... [20s elapsed]
aws_s3_bucket.testBucket: Still creating... [30s elapsed]
aws_s3_bucket.testBucket: Still creating... [40s elapsed]
aws_s3_bucket.testBucket: Still creating... [50s elapsed]
aws_s3_bucket.testBucket: Still creating... [1m0s elapsed]
aws_s3_bucket.testBucket: Still creating... [1m10s elapsed]
aws_s3_bucket.testBucket: Still creating... [1m20s elapsed]
aws_s3_bucket.testBucket: Still creating... [1m30s elapsed]
aws_s3_bucket.testBucket: Still creating... [1m40s elapsed]
aws_s3_bucket.testBucket: Still creating... [1m50s elapsed]
aws_s3_bucket.testBucket: Still creating... [2m0s elapsed]
aws_s3_bucket.testBucket: Still creating... [2m10s elapsed]
aws_s3_bucket.testBucket: Still creating... [2m20s elapsed]
aws_s3_bucket.testBucket: Still creating... [2m30s elapsed]
Error: error getting S3 Bucket website configuration: timeout while waiting for state to become 'success' (timeout: 2m0s)
on localstack.tf line 14, in resource "aws_s3_bucket" "testBucket":
14: resource "aws_s3_bucket" "testBucket" {
Any advice or people with the same issue?
You're using the (now 2 year old) atlassianlabs/localstack Docker image.
Does it work when using the localstack/localstack image?
@Deblob12 As mentioned by @cmjacques , please don't use the old image. The recent changes are pushed under the new image name localstack/localstack.
Also, instead of running docker run directly, it would be better to install the latest command line, and then simply run localstack start (which should start up the Docker container). Can you give that a try?
Yes it worked using localstack/localstack. Thanks for all the help!
Most helpful comment
Yes it worked using
localstack/localstack. Thanks for all the help!