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: Allow cluster_settings to be list of maps instead of single map #157

Merged
merged 2 commits into from
Feb 12, 2024
Merged

fix: Allow cluster_settings to be list of maps instead of single map #157

merged 2 commits into from
Feb 12, 2024

Conversation

ivan-sukhomlyn
Copy link
Contributor

@ivan-sukhomlyn ivan-sukhomlyn commented Jan 26, 2024

Description

Define cluster_settings as a list of maps to possibly define other parameters in the future.

Motivation and Context

Currently, a single containerInsights parameter can be defined.

Breaking Changes

No, using flatten list at the for_each meta-argument allows to use both map and list value at the cluster_settings variable.

How Has This Been Tested?

  • I have updated at least one of the examples/* to demonstrate and validate my change(s)
  • I have tested and validated these changes using one or more of the provided examples/* projects
  • I have executed pre-commit run -a on my pull request

define a custom value for cluster_settings as a list of maps or a map.
For example,

  cluster_settings = [
    {
      name  = "containerInsights"
      value = "disabled"
    }
  ]

or

  cluster_settings = {
    name  = "containerInsights"
    value = "disabled"
  }
$ pre-commit run -a
Terraform fmt............................................................Passed
Terraform wrapper with for_each in module................................Passed
Terraform validate.......................................................Passed
Terraform docs...........................................................Passed
Terraform validate with tflint...........................................Passed
check for merge conflicts................................................Passed
fix end of files.........................................................Passed

@ivan-sukhomlyn ivan-sukhomlyn changed the title fix: define cluster_settings as list instead of single map fix: define cluster_settings as list of maps instead of a single map Jan 26, 2024
@ivan-sukhomlyn ivan-sukhomlyn changed the title fix: define cluster_settings as list of maps instead of a single map fix: define cluster_settings as list of maps instead of single map Jan 26, 2024
@ivan-sukhomlyn ivan-sukhomlyn changed the title fix: define cluster_settings as list of maps instead of single map fix: Define cluster_settings as list of maps instead of single map Jan 26, 2024
Copy link
Member

@bryantbiggs bryantbiggs left a comment

Choose a reason for hiding this comment

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

why is this change warranted if the only value that ECS supports is containerInsights? https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_cluster#setting

@ivan-sukhomlyn
Copy link
Contributor Author

@bryantbiggs maybe it's a wrong declaration of a PR from my side and needs to be renamed to the refactor!:
Mainly, the change is for possible further extension of settings (for example, adding a new setting) for the ECS cluster and due to the setting actually being dynamically defined via for_each wrapping a map into a set.

@bryantbiggs
Copy link
Member

@antonbabenko what are your thoughts on creating a temporary v6 branch to pull in these various PRs that are breaking changes and then once those are complete, merge in that branch as the next major release? Trying to think of a way to allow crowd sourcing these changes instead of the normal way (i.e. - one person bunches everything up in a breaking change PR on their own)?

I started a milestone to track these changes https://github.com/terraform-aws-modules/terraform-aws-ecs/milestone/1

Copy link
Member

@antonbabenko antonbabenko left a comment

Choose a reason for hiding this comment

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

I think we can make it without introducing the BC break.

@bryantbiggs We can have v6 branch for small crowd-sourcing PRs like you said, but I don't think that this one is actually breaking anything and we can make it to v5 without introducing breaking changes.

modules/cluster/main.tf Outdated Show resolved Hide resolved
modules/cluster/variables.tf Outdated Show resolved Hide resolved
variables.tf Outdated Show resolved Hide resolved
@ivan-sukhomlyn
Copy link
Contributor Author

@bryantbiggs I've tested with flatten list at the for_each meta-argument with cluster_settings variable value.
In all cases, there are no errors and changes of resources with both types of the cluster_setting variable.

  cluster_settings = [{
    name  = "containerInsights"
    value = "disabled"
  }]

or

  cluster_settings = {
    name  = "containerInsights"
    value = "disabled"
  }

The PR description has been updated accordingly.

@antonbabenko thanks for the suggestion 💪

@antonbabenko
Copy link
Member

antonbabenko commented Feb 12, 2024

@ivan-sukhomlyn Looks good to me, and it is not a breaking change anymore. :)

@bryantbiggs I don't know what has changed in GitHub, but we suddenly get "WIP" checks blocking the merge. I disabled "WIP" on all our repositories.

Copy link
Member

@bryantbiggs bryantbiggs left a comment

Choose a reason for hiding this comment

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

its the WIP bot that just won't die 😅

@antonbabenko
Copy link
Member

This WIP bot made everybody look busy working on everything at once :)

@antonbabenko antonbabenko changed the title fix: Define cluster_settings as list of maps instead of single map fix: Allow cluster_settings to be list of maps instead of single map Feb 12, 2024
@antonbabenko antonbabenko merged commit c32a657 into terraform-aws-modules:master Feb 12, 2024
12 checks passed
antonbabenko pushed a commit that referenced this pull request Feb 12, 2024
### [5.8.1](v5.8.0...v5.8.1) (2024-02-12)

### Bug Fixes

* Allow `cluster_settings` to be list of maps instead of single map ([#157](#157)) ([c32a657](c32a657))
@antonbabenko
Copy link
Member

This PR is included in version 5.8.1 🎉

@ivan-sukhomlyn ivan-sukhomlyn deleted the fix/cluster_setting_list branch February 12, 2024 14:14
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants