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

Fix some loops only picking up one element from the list #43

Merged
merged 8 commits into from
Jul 10, 2024

Conversation

Roberdvs
Copy link
Contributor

@Roberdvs Roberdvs commented Aug 18, 2022

Hi!

While using this module we discovered that adding multiple managed_policies inside the permission sets block or adding more than one permission_set to groups/users inside group_assignments or user_assignments had no effect as it was only picking up 1 single element from the list.

This fixes it by calling the merge function on the maps to create a list based on the suggestion from this StackOverflow answer

Tested it in our setup and now it properly adds the missing attachments/assignments.

Also a small refactor to improve code reuse using locals.

@Stretch96
Copy link
Member

Hi @Roberdvs, thanks for this 👍

(I think I've not noticed this bug yet because we've not attempted to use multiple permission sets)

Also I do want to fix the wild code that's in there lol ... eg. use objects to make it easier to understand what structure is required

I've recently just updated a few things for the module, and there's some conflicts now - If you could rebase, I'll test it out and get this merged in

@Roberdvs
Copy link
Contributor Author

Hi @Roberdvs, thanks for this 👍

(I think I've not noticed this bug yet because we've not attempted to use multiple permission sets)

Also I do want to fix the wild code that's in there lol ... eg. use objects to make it easier to understand what structure is required

I've recently just updated a few things for the module, and there's some conflicts now - If you could rebase, I'll test it out and get this merged in

Hi @Stretch96 !

Thanks for taking a look.

I've fixed the conflicts but switched the aws provider version constraint from ~> to >= to follow Terraform best practices for reusable modules and allow more flexibility when setting the provider version on the root module.

Cheers!

@Stretch96
Copy link
Member

Ah yes, you're right @Roberdvs - The >= is correct 👍

Reusable modules should constrain only their minimum allowed versions of Terraform and providers, such as >= 0.12.0. This helps avoid known incompatibilities, while allowing the user of the module flexibility to upgrade to newer versions of Terraform without altering the module.

I think I was attempting to be restrictive with the version, to ensure it's only used within the versions it has been tested with ...

@Stretch96
Copy link
Member

@Roberdvs Could you run a terraform fmt on the branch and rebase again, and I'll test this today

@Roberdvs
Copy link
Contributor Author

@Roberdvs Could you run a terraform fmt on the branch and rebase again, and I'll test this today

Done!

Updated also the required_providers block that was using a deprecated format.

@rjw1
Copy link
Collaborator

rjw1 commented Jul 9, 2024

@Stretch96 We also want to apply multiple permission sets to an account now. So fee free to spend some work time on this.

@Stretch96
Copy link
Member

Stretch96 commented Jul 10, 2024

Coolios

I've also added you as an admin on this repo, and @DrizzlyOwl has write so we can develop on this as normal

(One of those side-projects that ended up being used Lol)

@Stretch96 Stretch96 merged commit b636132 into chris-qa-org:main Jul 10, 2024
3 checks passed
@Stretch96
Copy link
Member

Thanks for the PR @Roberdvs 👍

This has been merged now and released - https://github.com/chris-qa-org/terraform-aws-organzation-and-sso/releases/tag/v1.2.0

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.

3 participants