/ | `list(string)` | [
"gcs://fullstoryapp-warehouse-sync-bundles"
]
| no |
| [fullstory\_storage\_provider](#input\_fullstory\_storage\_provider) | The storage provider to use. Either 'S3', 'GCS' or 'AZURE'. This is an advanced option and should only be changed if instructed by Fullstory. | `string` | `"GCS"` | no |
-| [password](#input\_password) | The password to use for the Snowflake user. | `string` | `null` | no |
+| [manage\_password](#input\_manage\_password) | Whether to create a random password and use it for the Snowflake user. If false and no password or RSA public key is provided, the user will be created without a password. | `bool` | `true` | no |
+| [password](#input\_password) | The password to use for the Snowflake user. Use manage\_password=true if you want to generate a random password. | `string` | `null` | no |
| [role\_name](#input\_role\_name) | The name of the Snowflake role to create. | `string` | `null` | no |
| [rsa\_public\_key](#input\_rsa\_public\_key) | The RSA public key to use for the Snowflake user. Must be on 1 line without header and trailer. | `string` | `null` | no |
| [rsa\_public\_key\_2](#input\_rsa\_public\_key\_2) | The second RSA public key to use for the Snowflake user. Used when rotating keys. Must be on 1 line without header and trailer. | `string` | `null` | no |
diff --git a/main.tf b/main.tf
index 8465e62..27b0026 100644
--- a/main.tf
+++ b/main.tf
@@ -44,7 +44,7 @@ resource "snowflake_grant_privileges_to_role" "warehouse" {
}
resource "random_password" "main" {
- count = (var.disable_password || var.password != null) ? 0 : 1
+ count = var.manage_password ? 1 : 0
length = 16
special = true
override_special = "!#$%&*()-_=+[]{}<>:?"
@@ -55,7 +55,7 @@ resource "snowflake_user" "main" {
name = "FULLSTORY_WAREHOUSE_SETUP_${local.suffix}"
default_warehouse = var.warehouse_name
default_role = snowflake_role.main.name
- password = var.disable_password ? "" : (var.password != null ? var.password : random_password.main[0].result)
+ password = var.manage_password ? random_password.main[0].result : var.password
rsa_public_key = var.rsa_public_key
rsa_public_key_2 = var.rsa_public_key_2
}
diff --git a/variables.tf b/variables.tf
index 49ac369..0dd43ce 100644
--- a/variables.tf
+++ b/variables.tf
@@ -17,7 +17,7 @@ variable "stage_name" {
variable "password" {
type = string
- description = "The password to use for the Snowflake user."
+ description = "The password to use for the Snowflake user. Use manage_password=true if you want to generate a random password."
default = null
sensitive = true
}
@@ -74,10 +74,10 @@ variable "warehouse_name" {
description = "The name of the Snowflake warehouse to use."
}
-variable "disable_password" {
+variable "manage_password" {
type = bool
- default = false
- description = "Whether to disable the password for the Snowflake user. If true, the user will only be able to authenticate using the RSA public key."
+ default = true
+ description = "Whether to create a random password and use it for the Snowflake user. If false and no password or RSA public key is provided, the user will be created without a password."
}
variable "rsa_public_key" {