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

digitalocean_spaces_bucket NoSuchBucket while creating bucket #1153

Open
srasul opened this issue May 3, 2024 · 3 comments
Open

digitalocean_spaces_bucket NoSuchBucket while creating bucket #1153

srasul opened this issue May 3, 2024 · 3 comments
Labels

Comments

@srasul
Copy link

srasul commented May 3, 2024

Bug Report


Describe the bug

When creating a Spaces Bucket via Terraform, we get a timeout and and the following error:

Error: NoSuchBucket: status code: 404, request id:

Affected Resource(s)

Expected Behavior

The bucket should be created sucessfully

Actual Behavior

There is a timout waiting for the bucket to be created.

I went to the Digital Ocean web console and could see the Bucket was there, but Terraform was still waiting for this bucket to be created.

Steps to Reproduce

Terraform Configuration Files

Terraform version

2.34.1

Debug Output

{"@level":"info","@message":"digitalocean_spaces_bucket.this: Still creating... [10s elapsed]","@module":"terraform.ui","@timestamp":"2024-05-03T15:04:58.958499Z","hook":{"resource":{"addr":"digitalocean_spaces_bucket.this","module":"","resource":"digitalocean_spaces_bucket.this","implied_provider":"digitalocean","resource_type":"digitalocean_spaces_bucket","resource_name":"this","resource_key":null},"action":"create","elapsed_seconds":10},"type":"apply_progress"}
 ...


{"@level":"info","@message":"digitalocean_spaces_bucket.this: Still creating... [5m0s elapsed]","@module":"terraform.ui","@timestamp":"2024-05-03T15:09:48.984307Z","hook":{"resource":{"addr":"digitalocean_spaces_bucket.this","module":"","resource":"digitalocean_spaces_bucket.this","implied_provider":"digitalocean","resource_type":"digitalocean_spaces_bucket","resource_name":"this","resource_key":null},"action":"create","elapsed_seconds":300},"type":"apply_progress"}
{"@level":"info","@message":"digitalocean_spaces_bucket.this: Creation errored after 5m2s","@module":"terraform.ui","@timestamp":"2024-05-03T15:09:51.030848Z","hook":{"resource":{"addr":"digitalocean_spaces_bucket.this","module":"","resource":"digitalocean_spaces_bucket.this","implied_provider":"digitalocean","resource_type":"digitalocean_spaces_bucket","resource_name":"this","resource_key":null},"action":"create","elapsed_seconds":302},"type":"apply_errored"}
{"@level":"error","@message":"Error: NoSuchBucket: \n\tstatus code: 404, request id: , host id: ","@module":"terraform.ui","@timestamp":"2024-05-03T15:09:51.538465Z","diagnostic":{"severity":"error","summary":"NoSuchBucket: \n\tstatus code: 404, request id: , host id: ","detail":"","address":"digitalocean_spaces_bucket.this","range":{"filename":"storage.tf","start":{"line":1,"column":46,"byte":45},"end":{"line":1,"column":47,"byte":46}},"snippet":{"context":"resource \"digitalocean_spaces_bucket\" \"this\"","code":"resource \"digitalocean_spaces_bucket\" \"this\" {","start_line":1,"highlight_start_offset":45,"highlight_end_offset":46,"values":[]}},"type":"diagnostic"}
Operation failed: failed running terraform apply (exit 1)

Panic Output

Additional context

We are 'applying' via Terraform Cloud.

Important Factoids

References

@srasul srasul added the bug label May 3, 2024
@srasul
Copy link
Author

srasul commented May 8, 2024

Did some digging around and found the following:

When I use the JavaScript AWS S3 API to create a bucket and add a bucket policy to this bucket, everything works immediately. I can then get the bucket as well it's bucket policy.

When I create another bucket with JavaScript AWS S3 API, and then use the s3cmd info on this bucket, I get a 404 NoSuchBucket error. And after about a minute I get the bucket info. I dug into the code for s3cmd, and it seems that it does to check if a bucket is available is a HTTPS call to the URL:

https://${bucket-name}.${region}.digitaloceanspaces.com/?location

and this returns a HTTP 404 NoSuchBucket. What is unclear to me is why the S3 API gives a result, but calling the URL on digitaloceanspaces.com produces a 404 that eventually gives a 200. Eventually = about 1-2 minutes, sometimes longer.

@nkotixwolf
Copy link

nkotixwolf commented Jun 6, 2024

This is affecting me as well @srasul . Has there been a fix or work around? @andrewsomething can you take a look at this? This is blocking creation of DO spaces via Terraform.

@srasul
Copy link
Author

srasul commented Jun 6, 2024

@nkotixwolf unfortunately I couldn't find a solution to this. My current workaround is to move the creation of the bucket out of Terraform and into additional code that runs before Terraform. Once the bucket is created, I pass the name of this bucket into Terraform as an input parameter so other Terraform resources can use it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants