-
Notifications
You must be signed in to change notification settings - Fork 127
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
provider/scaleway: add scaleway_bucket resource #94
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func resourceScalewayBucketRead(d *schema.ResourceData, m interface{}) error { | ||
scaleway := m.(*Client).scaleway | ||
|
||
_, err := scaleway.ListObjects(d.Get("name").(string)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so if this returns a not found error (e.g. a 404) we should clear the ID so this is detected and can be recreated e.g.
if err != nil {
if resp.StatusCode == 404 {
log.Printf("[DEBUG] Bucket %q was not found - removing from state!", name)
d.SetId("")
return nil
}
}
scaleway/resource_bucket.go
Outdated
if err != nil { | ||
return err | ||
} | ||
d.SetId("") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't need to clear the ID here
b7c87e4
to
9eb1d3c
Compare
@tombuildsstuff thanks for taking a look. I've addressed the feedback - would you mind another look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
This PR adds a new resource to the Scaleway provider:
scaleway_bucket
.This can be merged once Scaleway objectstorage is out of GA.
The PR includes docs, tests as well as the resource itself.