Skip to content

feat(object): bucket policy takes on bucket's region #2229

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

Conversation

Mia-Cross
Copy link
Contributor

@Mia-Cross Mia-Cross commented Nov 14, 2023

Closes #1934

The documentation on the object_bucket_policy resource lists the region as an attribute rather than an argument, so it does not have to be given. But if it's not the case, Terraform will try to create the policy in the default region fr-par, which only works if the bucket is also in fr-par.

This PR makes the object_bucket_policy resource have a similar behavior as the k8s_pool resource which takes on the region of the cluster. Here the policy will take on the region of the bucket it is attached to (if not explicitly given by the user).

It was also necessary to change up a bit the testAccCheckScalewayObjectBucketExists function as it was only looking for buckets in fr-par region.

@remyleone remyleone marked this pull request as draft November 21, 2023 09:55
@Mia-Cross Mia-Cross force-pushed the object_bucket_policy_takes_on_bucket_region branch 3 times, most recently from c12fd00 to fcdba1e Compare November 23, 2023 14:24
@Mia-Cross
Copy link
Contributor Author

This behavior will be generalized to all resources that can be linked to an object_bucket.
--> When the region is not specified, the resource should take on the region of the bucket it is related to.

More PRs will follow (ideally one per resource) to make the region easily customizable in the tests and implement this feature.

Also, recent changes in the Scaleway S3 API broke some nightly tests so these PRs shall fix the problems resource by resource.

@Mia-Cross Mia-Cross force-pushed the object_bucket_policy_takes_on_bucket_region branch 2 times, most recently from 1f866bb to 3893241 Compare November 27, 2023 12:45
@Mia-Cross Mia-Cross force-pushed the object_bucket_policy_takes_on_bucket_region branch from 11e63e8 to e9d9408 Compare November 27, 2023 15:17
@Mia-Cross Mia-Cross marked this pull request as ready for review November 27, 2023 15:19
@remyleone remyleone enabled auto-merge November 27, 2023 17:03
@remyleone remyleone added this pull request to the merge queue Nov 27, 2023
Merged via the queue into scaleway:master with commit 6a255b0 Nov 27, 2023
@Mia-Cross Mia-Cross deleted the object_bucket_policy_takes_on_bucket_region branch November 27, 2023 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

scaleway_object_bucket_policy fails if bucket region is not fr-par
2 participants