Skip to content

Commit

Permalink
[AV-68063] Create Backup & DB Creds should not required optional fiel…
Browse files Browse the repository at this point in the history
…ds (#101)
  • Loading branch information
nidhi07kumar authored Nov 28, 2023
1 parent 02e9218 commit 2cb879f
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 11 deletions.
1 change: 1 addition & 0 deletions examples/backup/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,5 @@ variable "restore" {
replace_ttl_with = optional(string)
restore_times = number
})
default = null
}
4 changes: 2 additions & 2 deletions examples/database_credential/create_database_credential.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ output "database_credential_id" {
}

resource "capella_database_credential" "new_database_credential" {
name = var.database_credential_name
name = var.database_credential.database_credential_name
organization_id = var.organization_id
project_id = var.project_id
cluster_id = var.cluster_id
password = var.password
password = var.database_credential.password
access = var.access
}

8 changes: 6 additions & 2 deletions examples/database_credential/terraform.template.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ auth_token = "<v4-api-key-secret>"
organization_id = "<organization_id>"
project_id = "<project_id>"
host = "https://cloudapi.cloud.couchbase.com"
database_credential_name = "test_db_user"
cluster_id = "<cluster_id>"
password = "Secret12$#"

database_credential = {
database_credential_name = "test_db_user"
password = "Secret12$#"
}

access = [
{
privileges = ["data_writer"]
Expand Down
21 changes: 14 additions & 7 deletions examples/database_credential/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,28 @@ variable "project_id" {
description = "Capella Project ID"
}

variable "database_credential_name" {
description = "Database Credentials Name"
}

variable "cluster_id" {
description = "Capella Cluster ID"
}

variable "password" {
description = "password for database credential"
sensitive = true
variable "database_credential" {
type = object({
database_credential_name = string
password = optional(string)
})
}

variable "access" {
type = list(object({
privileges = list(string)
resources = optional(object({
buckets = list(object({
name = string
scopes = optional(list(object({
name = string
collections = optional(list(string))
})))
}))
}))
}))
}

0 comments on commit 2cb879f

Please sign in to comment.