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

feat: Add engine and engine_version_actual outputs #404

Merged
merged 7 commits into from
May 27, 2022
Merged

feat: Add engine and engine_version_actual outputs #404

merged 7 commits into from
May 27, 2022

Conversation

stefan-matic
Copy link
Contributor

@stefan-matic stefan-matic commented May 27, 2022

Description

Added new outputs for engine and engine_version_actual in module, examples, and README.

Motivation and Context

The output value for engine is needed when creating Secrets Manager RDS Credentials in the same way how it's created via the console. The keys that are created by default through the console are:

  • username
  • password
  • engine
  • host
  • port
  • dbname
  • dbInstanceIdentifier

When replicating the same approach via Terraform only the engine cannot be sourced using outputs.

resource "random_password" "master" {
  length           = 16
  special          = true
  override_special = "_!%^"
}

resource "aws_secretsmanager_secret" "rds_credentials" {
  name = "rds-credentials"
}

resource "aws_secretsmanager_secret_version" "rds_credentials" {
  secret_id     = aws_secretsmanager_secret.rds_credentials.id
  secret_string = jsonencode(
    {
      "username": "${module.db.db_instance_username}",
      "password": "${random_password.master.result}",
      "engine": "postgres",
      "host": "${module.db.db_instance_address}",
      "port": "${module.db.db_instance_port}",
      "dbname": "${module.db.db_instance_name}"
      "dbInstanceIdentifier": "${module.db.db_instance_id}"
    }
  )
}

Breaking Changes

No.

How Has This Been Tested?

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

@stefan-matic stefan-matic changed the title Add engine output feat: Add engine output May 27, 2022
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.

LGTM. Could you also add one more related output - engine_version_actual ?

@stefan-matic stefan-matic changed the title feat: Add engine output feat: Add engine and engine_version output May 27, 2022
@stefan-matic
Copy link
Contributor Author

@antonbabenko Added the engine_version_actual as output db_instance_engine_version

@antonbabenko antonbabenko changed the title feat: Add engine and engine_version output feat: Add engine and engine_version_actual outputs May 27, 2022
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.

Thanks for the PR @stefan-matic - looks great

@antonbabenko antonbabenko merged commit 00b9858 into terraform-aws-modules:master May 27, 2022
antonbabenko pushed a commit that referenced this pull request May 27, 2022
## [4.4.0](v4.3.0...v4.4.0) (2022-05-27)

### Features

* Add `engine` and `engine_version_actual` outputs ([#404](#404)) ([00b9858](00b9858))
@antonbabenko
Copy link
Member

This PR is included in version 4.4.0 🎉

@github-actions
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 Nov 13, 2022
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.

None yet

3 participants