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: Fix the condition of the logical operators of master_user_name and master_user_password #4

Merged

Conversation

sshcokr
Copy link
Contributor

@sshcokr sshcokr commented Apr 4, 2024

Description

Injecting master_user_name and master_user_password will cause them to be treated as null, meaning their property values will not be applied.

An error exists in the logical operator for that property value.

  • master_user_name, master_user_password are treated as null if they are not null.
  • Shouldn't master_user_arn be treated as null if it is not null?

Motivation and Context

Breaking Changes

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

AS-IS

  dynamic "advanced_security_options" {
    ...

      dynamic "master_user_options" {
        for_each = try([advanced_security_options.value.master_user_options], [{}])

        content {
          master_user_arn      = try(master_user_options.value.master_user_arn, null) == null ? try(master_user_options.value.master_user_arn, data.aws_iam_session_context.current[0].issuer_arn) : null
          master_user_name     = try(master_user_options.value.master_user_name, null) == null ? try(master_user_options.value.master_user_name, null) : null
          master_user_password = try(master_user_options.value.master_user_password, null) == null ? try(master_user_options.value.master_user_password, null) : null
        }
      }
    }
  }

TO-BE

  dynamic "advanced_security_options" {
    ...

      dynamic "master_user_options" {
        for_each = try([advanced_security_options.value.master_user_options], [{}])

        content {
          master_user_arn      = try(master_user_options.value.master_user_arn, null) == null ? try(master_user_options.value.master_user_arn, data.aws_iam_session_context.current[0].issuer_arn) : null
          master_user_name     = try(master_user_options.value.master_user_arn, null) == null ? try(master_user_options.value.master_user_name, null) : null
          master_user_password = try(master_user_options.value.master_user_arn, null) == null ? try(master_user_options.value.master_user_password, null) : null
        }
      }
    }
  }

@strangeman
Copy link
Contributor

#5 is another way to fix the same problem

@bryantbiggs bryantbiggs changed the title fix: Fix the condition of the logical operators of 'master_user_name' and 'master_user_password' fix: Fix the condition of the logical operators of master_user_name and master_user_password Apr 9, 2024
@bryantbiggs bryantbiggs merged commit fa811d2 into terraform-aws-modules:master Apr 9, 2024
10 checks passed
antonbabenko pushed a commit that referenced this pull request Apr 9, 2024
## [1.1.1](v1.1.0...v1.1.1) (2024-04-09)

### Bug Fixes

* Fix the condition of the logical operators of `master_user_name` and `master_user_password` ([#4](#4)) ([fa811d2](fa811d2))
@antonbabenko
Copy link
Member

This PR is included in version 1.1.1 🎉

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 May 10, 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.

4 participants