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

provider/scaleway: add scaleway_bucket resource #94

Merged
merged 1 commit into from
Oct 4, 2018

Conversation

nicolai86
Copy link
Contributor

@nicolai86 nicolai86 commented Sep 13, 2018

This PR adds a new resource to the Scaleway provider: scaleway_bucket.

This can be merged once Scaleway objectstorage is out of GA.

make testacc TESTARGS="-run='TestAccScalewayBucket'"
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test $(go list ./... |grep -v 'vendor') -v -run='TestAccScalewayBucket' -timeout 120m
?   	github.com/terraform-providers/terraform-provider-scaleway	[no test files]
=== RUN   TestAccScalewayBucket
--- PASS: TestAccScalewayBucket (13.35s)
PASS
ok  	github.com/terraform-providers/terraform-provider-scaleway/scaleway

The PR includes docs, tests as well as the resource itself.

Copy link
Contributor

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey @nicolai86

Left a couple of comments in-line - but this otherwise LGTM 👍

Thanks!

func resourceScalewayBucketRead(d *schema.ResourceData, m interface{}) error {
scaleway := m.(*Client).scaleway

_, err := scaleway.ListObjects(d.Get("name").(string))
Copy link
Contributor

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
  }
}

if err != nil {
return err
}
d.SetId("")
Copy link
Contributor

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

@nicolai86
Copy link
Contributor Author

@tombuildsstuff thanks for taking a look. I've addressed the feedback - would you mind another look?

@nicolai86 nicolai86 assigned tombuildsstuff and unassigned remyleone Oct 2, 2018
Copy link
Contributor

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@nicolai86 nicolai86 merged commit 57147ab into master Oct 4, 2018
@nicolai86 nicolai86 deleted the scaleway-bucket branch October 4, 2018 02:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants