generated from terraform-modules/template_aws_submodules
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(sc-db-user) add policy for sc-db-user
rename to sc-dbuser update from comments fix syntax for passthrough var remove jbid stuff reduce to postgres usecase requirements only update changelog fix name Create README.md adding RDS MFA converted from .docx Update README.md with RDS MFA steps Create temp file in folder Add files via upload
- Loading branch information
Showing
26 changed files
with
278 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
|
|
||
| 1. **Enable IAM authentication on the Postgres DB instance or Aurora Postgres Cluster** | ||
|
|
||
| **Terraform:** | ||
|
|
||
| Set iam\_database\_authentication\_enabled = true within the Instance or the Cluster resource and apply. | ||
|
|
||
| **Console:** | ||
|
|
||
| * 1. Enable IAM Authentication on the DB Instance | ||
| 1. Go to **RDS Console** → Select your **DB instance or the Cluster**. | ||
| 2. Choose **Modify**. | ||
| 3. Scroll to **Database Authentication**. | ||
| 4. Set **IAM DB authentication** to **Enabled**. | ||
| 5. Click **Continue** → **Apply Immediately** or during the next maintenance window. | ||
| 6. This allows the DB instance to accept IAM token-based logins | ||
|
|
||
| **CLI:** | ||
|
|
||
| aws rds modify-db-instance \ | ||
| --db-instance-identifier <your-db-instance-identifier> \ | ||
| --enable-iam-database-authentication \ | ||
| --apply-immediately | ||
|
|
||
| aws rds modify-db-cluster \ | ||
| --db-cluster-identifier your-aurora-cluster-identifier \ | ||
| --enable-iam-database-authentication \ | ||
| --apply-immediately | ||
|
|
||
| 1. **Create IAM User/Role and assign IAM Policy (Please Confirm with Matt Morgan from SCT - INC000003161057)** | ||
|
|
||
| Policy: | ||
|
|
||
| For RDS: | ||
|
|
||
| { | ||
| "Version" : "2012-10-17", | ||
| "Statement" : | ||
| [ | ||
| { | ||
| "Effect" : "Allow", | ||
| "Action" : ["rds-db:connect"], | ||
| "Resource" : ["arn:aws:rds-db:us-east-1:123456789012:dbuser:db-ABCDEFGHIJKL01234/mydbuser"] | ||
| } | ||
| ] | ||
| } | ||
| For Aurora: | ||
|
|
||
| { | ||
| "Version" : "2012-10-17", | ||
| "Statement" : | ||
| [ | ||
| { | ||
| "Effect" : "Allow", | ||
| "Action" : ["rds-db:connect"], | ||
| "Resource" : ["arn:aws:rds-db:us-east-1:123456789012:dbuser:cluster-ABCDEFGHIJKL01234/mydbuser"] | ||
| } | ||
| ] | ||
| } | ||
|
|
||
| 1. **Enable IAM authentication for the database JBID user** | ||
|
|
||
| Grant rds\_iam to <JBID>; | ||
|
|
||
| 1. Launch the URL from production network to access AWS Console using Identity Center | ||
|
|
||
| <https://start.us-gov-east-1.us-gov-home.awsapps.com/directory/d-c2672d0b4e#/> | ||
|
|
||
|  | ||
|
|
||
| Once verified via the phone Okta verify app, successfully logged in. | ||
|
|
||
|  | ||
|
|
||
|  | ||
|
|
||
| Retrieve the Access keys: | ||
|
|
||
|  | ||
|
|
||
| Generate DB token after setting the keys in Power shell or Command prompt. | ||
|
|
||
|  | ||
|
|
||
|  | ||
|
|
||
| Copy the token and paste in the password box in PGADMIN or DBeaver tools. | ||
|
|
||
| Token can be obtained only after getting authenticated with MFA. | ||
|
|
||
| Login should be successful. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
|
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| ## Requirements | ||
|
|
||
| | Name | Version | | ||
| |------|---------| | ||
| | <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.12 | | ||
| | <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 6.0 | | ||
|
|
||
| ## Providers | ||
|
|
||
| | Name | Version | | ||
| |------|---------| | ||
| | <a name="provider_aws"></a> [aws](#provider\_aws) | >= 6.0 | | ||
|
|
||
| ## Modules | ||
|
|
||
| No modules. | ||
|
|
||
| ## Resources | ||
|
|
||
| | Name | Type | | ||
| |------|------| | ||
| | [aws_arn.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/arn) | data source | | ||
| | [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source | | ||
| | [aws_iam_policy_document.inline](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source | | ||
| | [aws_region.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) | data source | | ||
|
|
||
| ## Inputs | ||
|
|
||
| | Name | Description | Type | Default | Required | | ||
| |------|-------------|------|---------|:--------:| | ||
| | <a name="input_account_alias"></a> [account\_alias](#input\_account\_alias) | AWS Account Alias | `string` | `""` | no | | ||
| | <a name="input_account_id"></a> [account\_id](#input\_account\_id) | AWS Account ID (default will pull from current user) | `string` | `""` | no | | ||
| | <a name="input_override_prefixes"></a> [override\_prefixes](#input\_override\_prefixes) | Override built-in prefixes by component. This should be used primarily for common infrastructure things | `map(string)` | `{}` | no | | ||
| | <a name="input_tags"></a> [tags](#input\_tags) | AWS Tags to apply to appropriate resources | `map(string)` | `{}` | no | | ||
|
|
||
| ## Outputs | ||
|
|
||
| | Name | Description | | ||
| |------|-------------| | ||
| | <a name="output_customer_managed_policy_names"></a> [customer\_managed\_policy\_names](#output\_customer\_managed\_policy\_names) | Map of policy name to permission boundary of Customer Managed Policy to attach to the permissionset | | ||
| | <a name="output_inline_policy"></a> [inline\_policy](#output\_inline\_policy) | AWS Policy document for the single allowed inline policy (use .json to get policy) | | ||
| | <a name="output_managed_policy_names"></a> [managed\_policy\_names](#output\_managed\_policy\_names) | Names of AWS Managed Policy to attach to the permissionset | | ||
| | <a name="output_name"></a> [name](#output\_name) | Permission Set Name for which all settings apply | | ||
| | <a name="output_relay_state"></a> [relay\_state](#output\_relay\_state) | Relay State to pass along to permissionset | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| locals { | ||
| all_account_arn_iam = format("arn:%v:%v::%v:%%v", data.aws_arn.current.partition, "iam", "*") | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../../common/data.tf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../../common/defaults.tf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| locals { | ||
| account_id = var.account_id != "" ? var.account_id : data.aws_caller_identity.current.account_id | ||
| account_environment = data.aws_arn.current.partition == "aws-us-gov" ? "gov" : "ew" | ||
| region = data.aws_region.current.region | ||
| region_short = join("", [for c in split("-", local.region) : substr(c, 0, 1)]) | ||
|
|
||
| base_tags = { | ||
| "boc:tf_module_version" = local._module_version | ||
| "boc:tf_module_name" = local._module_name | ||
| "boc:created_by" = "terraform" | ||
| } | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| /* | ||
| */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| locals { | ||
| _module_name = "aws-sso/policies/sc-dbuser" | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| output "name" { | ||
| description = "Permission Set Name for which all settings apply" | ||
| value = local.name | ||
| } | ||
|
|
||
| output "managed_policy_names" { | ||
| description = "Names of AWS Managed Policy to attach to the permissionset" | ||
| value = local.managed_policy_names | ||
| } | ||
|
|
||
| output "customer_managed_policy_names" { | ||
| description = "Map of policy name to permission boundary of Customer Managed Policy to attach to the permissionset" | ||
| value = local.customer_managed_policy_names | ||
| } | ||
|
|
||
| output "inline_policy" { | ||
| description = "AWS Policy document for the single allowed inline policy (use .json to get policy)" | ||
| value = local.inline_policy | ||
| } | ||
|
|
||
| output "relay_state" { | ||
| description = "Relay State to pass along to permissionset" | ||
| value = local.relay_state | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| data "aws_iam_policy_document" "inline" { | ||
| statement { | ||
| sid = "AllowRDSDB" | ||
| effect = "Allow" | ||
| resources = ["*"] | ||
| actions = [ | ||
| "rds-db:connect", | ||
| "rds:DescribeDBInstances", | ||
| "rds:DescribeDBClusters", | ||
| "rds:DescribeDBInstancesPerformance", | ||
| "rds:DescribeDBClustersPerformance", | ||
| "pi:DescribeDimensionKeys", | ||
| "pi:GetResourceMetrics", | ||
| "pi:ListAvailableResourceDimensions", | ||
| "pi:ListAvailableResourceMetrics" | ||
| ] | ||
| } | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../../common/prefixes.tf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| locals { | ||
| name = "sc-dbuser" | ||
| description = "System Common DB User" | ||
| managed_policy_names = [ | ||
| "ReadOnlyAccess", | ||
| ] | ||
| customer_managed_policy_names = {} | ||
| relay_state = null | ||
| inline_policy = data.aws_iam_policy_document.inline | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../../common/variables.common.tf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| variable "name" { | ||
| description = "Permission Set Name for which all settings apply" | ||
| type = string | ||
| default = null | ||
| } | ||
|
|
||
| variable "managed_policy_names" { | ||
| description = "Names of AWS Managed Policy to attach to the permissionset" | ||
| type = list(string) | ||
| default = [] | ||
| } | ||
|
|
||
| variable "customer_managed_policy_names" { | ||
| description = "Map of policy name to permission boundary of Customer Managed Policy to attach to the permissionset" | ||
| type = map(string) | ||
| default = {} | ||
| } | ||
|
|
||
| # variable "inline_policy" { | ||
| # description = "AWS Policy document for the single allowed inline policy" | ||
| # type = string | ||
| # default = null | ||
| # } | ||
|
|
||
| variable "relay_state" { | ||
| description = "Relay State to pass along to permissionset" | ||
| type = string | ||
| default = null | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../../common/version.tf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../../common/versions.tf |