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

add support for iam group resource #1350

Merged
merged 22 commits into from
Jul 7, 2022

Conversation

Mia-Cross
Copy link
Contributor

I managed to keep things the way they worked before the breaking changes of the IAM API, all my tests with users. applications and both at the same time work fine without these attributes being required, I think it's more user-friendly this way.

@codecov-commenter
Copy link

codecov-commenter commented Jun 29, 2022

Codecov Report

Merging #1350 (6e6b178) into master (efb453b) will decrease coverage by 0.83%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##           master    #1350      +/-   ##
==========================================
- Coverage   69.34%   68.50%   -0.84%     
==========================================
  Files         112      114       +2     
  Lines       17964    18183     +219     
==========================================
  Hits        12457    12457              
- Misses       4424     4643     +219     
  Partials     1083     1083              
Impacted Files Coverage Δ
scaleway/data_source_iam_group.go 0.00% <0.00%> (ø)
scaleway/provider.go 71.81% <0.00%> (-0.56%) ⬇️
scaleway/resource_iam_group.go 0.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update efb453b...6e6b178. Read the comment docs.

@remyleone remyleone changed the title Diff iam group resource add support for iam group resource Jul 5, 2022

data "scaleway_iam_group" "find_by_id_basic" {
group_id = scaleway_iam_group.main_ds_basic.id
organization_id = "08555df8-bb26-43bc-b749-1b98c5d02343"
Copy link
Member

Choose a reason for hiding this comment

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

Can the organization_id be deduced from the provider settings? it seems cumbersome to specify it again

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For now it is not possible for requests that use query arguments like ListGroups, so it affects the sweeper functions and the search by name in datasources. After discussing it with the team, the solution we found was to temporarily make the organization_id required in datasources (every iam datasource is concerned).
Apparently, it's related to this issue.

if d.HasChange("name") {
req.Name = expandStringPtr(d.Get("name").(string))
} else {
req.Name = &group.Name
Copy link
Member

Choose a reason for hiding this comment

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

Why should we have this else branch? Shouldn't we send only the thing we wish to modify?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The Update request uses the PATCH method, not PUT so we have to send all information, even if we don't want to modify all of them. But indeed the way I wrote it could be improved so I've changed it a bit.

@remyleone remyleone mentioned this pull request Jul 5, 2022
2 tasks
@Mia-Cross
Copy link
Contributor Author

Mia-Cross commented Jul 5, 2022

The problem with the order of IDs has been resolved by using a TypeSet instead of a TypeList for the application_ids and user_ids attributes so that we can check that the values are contained in the set without specifying the index.
In the meantime, the AUTH team has handled the issue I had opened about the description that could not be unset, so now all tests succeed.

@remyleone remyleone merged commit 56f10e2 into scaleway:master Jul 7, 2022
Mia-Cross added a commit to Mia-Cross/terraform-provider-scaleway that referenced this pull request Jul 7, 2022
@remyleone remyleone added the iam IAM issues, bugs and feature requests label Jul 28, 2022
@Mia-Cross Mia-Cross deleted the diff_iam_group_resource branch January 27, 2023 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
iam IAM issues, bugs and feature requests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants