Skip to content

Commit d3f93a1

Browse files
refactor: rename QuickSight username variable and improve admin user configuration
1 parent 991f53d commit d3f93a1

File tree

8 files changed

+20
-16
lines changed

8 files changed

+20
-16
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ module "cudos_framework" {
3636
enable_sso = true
3737
enable_tao_dashboard = false
3838
saml_metadata = file("${path.module}/assets/saml-metadata.xml")
39-
quicksight_username = var.quicksight_username
39+
quicksight_dashboard_owner = var.quicksight_dashboard_owner
4040
tags = var.tags
4141
4242
providers = {

examples/basic/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ No providers.
66

77
## Inputs
88

9-
| Name | Description | Type | Default | Required |
10-
| -------------------------------------------------------------------------------------------- | ------------------------------------- | ------------- | --------------------------------------------------- | :------: |
11-
| <a name="input_quicksight_username"></a> [quicksights_username](#input_quicksights_username) | The username to use for QuickSight | `string` | `"admin"` | no |
12-
| <a name="input_tags"></a> [tags](#input_tags) | A map of tags to add to all resources | `map(string)` | <pre>{<br/> "Environment": "Production"<br/>}</pre> | no |
9+
| Name | Description | Type | Default | Required |
10+
| --------------------------------------------------------------------------------------------------- | ------------------------------------- | ------------- | --------------------------------------------------- | :------: |
11+
| <a name="input_quicksight_dashboard_owner"></a> [quicksights_username](#input_quicksights_username) | The username to use for QuickSight | `string` | `"admin"` | no |
12+
| <a name="input_tags"></a> [tags](#input_tags) | A map of tags to add to all resources | `map(string)` | <pre>{<br/> "Environment": "Production"<br/>}</pre> | no |
1313

1414
## Outputs
1515

examples/basic/main.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ module "destination" {
1818
dashboards_bucket_name = local.dashboard_bucket_name
1919
enable_sso = true
2020
payer_accounts = ["1234343434"]
21-
quicksight_username = var.quicksight_username
21+
quicksight_dashboard_owner = var.quicksight_dashboard_owner
2222
saml_metadata = file("${path.module}/assets/saml-metadata.xml")
2323
tags = var.tags
2424

examples/basic/variables.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ variable "tags" {
77
}
88
}
99

10-
variable "quicksight_username" {
10+
variable "quicksight_dashboard_owner" {
1111
description = "The username to use for QuickSight"
1212
type = string
1313
default = "admin"

modules/destination/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
| <a name="input_quicksight_subscription_edition"></a> [quicksight_subscription_edition](#input_quicksight_subscription_edition) | The edition for the QuickSight quicksight_subscription | `string` | `"ENTERPRISE"` | no |
4848
| <a name="input_quicksight_subscription_email"></a> [quicksight_subscription_email](#input_quicksight_subscription_email) | The email address for the QuickSight quicksight_subscription edition | `string` | `null` | no |
4949
| <a name="input_quicksight_users"></a> [quicksight_users](#input_quicksight_users) | Map of user accounts to be registered in QuickSight | <pre>map(object({<br/> identity_type = optional(string, "IAM")<br/> namespace = optional(string, "default")<br/> role = optional(string, "READER")<br/> }))</pre> | `{}` | no |
50-
| <a name="input_quicksight_username"></a> [quicksights_username](#input_quicksights_username) | The username for the QuickSight user | `string` | `"admin"` | no |
50+
| <a name="input_quicksight_dashboard_owner"></a> [quicksights_username](#input_quicksights_username) | The username for the QuickSight user | `string` | `"admin"` | no |
5151
| <a name="input_saml_iam_role_name"></a> [saml_iam_role_name](#input_saml_iam_role_name) | Name of the role all authentication users are initially given | `string` | `"aws-cudos-sso"` | no |
5252
| <a name="input_saml_metadata"></a> [saml_metadata](#input_saml_metadata) | The configuration for the SAML identity provider | `string` | `null` | no |
5353
| <a name="input_saml_provider_name"></a> [saml_provider_name](#input_saml_provider_name) | The name of the SAML provider | `string` | `"aws-cudos-sso"` | no |

modules/destination/locals.tf

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ locals {
99
## The URL for the s3 bucket containing cloudformation scripts
1010
bucket_url = format("https://%s.s3.%s.amazonaws.com", var.cloudformation_bucket_name, local.region)
1111
## Indicates if we should provision the quicksight admin user
12-
enable_admin = var.enable_quicksight_admin && var.quicksight_admin_email != null
1312

1413
## Is the user mappings for the quicksight groups
1514
user_group_mappings = merge([

modules/destination/main.tf

+2-2
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ resource "aws_quicksight_account_subscription" "subscription" {
104104

105105
## Provision a administator user in quicksight
106106
resource "aws_quicksight_user" "admin" {
107-
count = local.enable_admin ? 1 : 0
107+
count = var.create_quicksight_admin_user ? 1 : 0
108108

109109
email = var.quicksight_admin_email
110110
identity_type = "QUICKSIGHT"
@@ -264,7 +264,7 @@ module "dashboards" {
264264
"DeployTAODashboard" = var.enable_tao_dashboard ? "yes" : "no"
265265
"PrerequisitesQuickSight" = var.enable_prerequisites_quicksight ? "yes" : "no"
266266
"PrerequisitesQuickSightPermissions" = var.enable_prerequisites_quicksight_permissions ? "yes" : "no"
267-
"QuickSightUser" = var.quicksight_username
267+
"QuickSightUser" = var.quicksight_dashboard_owner
268268
}
269269

270270
depends_on = [

modules/destination/variables.tf

+10-5
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ variable "dashboards_bucket_name" {
8181
}
8282

8383
variable "enable_quicksight_admin" {
84-
description = "Enable the creation of an admin user (var.quicksight_username) in QuickSight"
84+
description = "Enable the creation of an admin user (var.quicksight_dashboard_owner) in QuickSight"
8585
type = bool
8686
default = true
8787
}
@@ -93,9 +93,14 @@ variable "quicksight_admin_username" {
9393
}
9494

9595
variable "quicksight_admin_email" {
96-
description = "The email address for the QuickSight admin user"
96+
description = "The email address for the QuickSight admin user. Required if var.create_quicksight_admin_user is true"
9797
type = string
98-
default = null
98+
}
99+
100+
variable "create_quicksight_admin_user" {
101+
description = "Whether to create a QuickSight admin user (var.quicksight_admin_username)"
102+
type = bool
103+
default = true
99104
}
100105

101106
variable "enable_sso" {
@@ -252,8 +257,8 @@ variable "quicksight_groups" {
252257
default = {}
253258
}
254259

255-
variable "quicksight_username" {
256-
description = "The username for the QuickSight user"
260+
variable "quicksight_dashboard_owner" {
261+
description = "The username for the QuickSight user who will own the dashboards. This user needs to exist. By default, it will be the admin user which is created by the module."
257262
type = string
258263
default = "admin"
259264
}

0 commit comments

Comments
 (0)