Skip to content

Latest commit

 

History

History
213 lines (177 loc) · 4.09 KB

mongodbatlas_database_user.md

File metadata and controls

213 lines (177 loc) · 4.09 KB

mongodbatlas_database_user

back

Index

Terraform

terraform {
  required_providers {
    mongodbatlas = ">= 0.8.2"
  }
}

top

Example Usage

module "mongodbatlas_database_user" {
  source = "./modules/mongodbatlas/r/mongodbatlas_database_user"

  # auth_database_name - (optional) is a type of string
  auth_database_name = null
  # aws_iam_type - (optional) is a type of string
  aws_iam_type = null
  # database_name - (optional) is a type of string
  database_name = null
  # password - (optional) is a type of string
  password = null
  # project_id - (required) is a type of string
  project_id = null
  # username - (required) is a type of string
  username = null
  # x509_type - (optional) is a type of string
  x509_type = null

  labels = [{
    key   = null
    value = null
  }]

  roles = [{
    collection_name = null
    database_name   = null
    role_name       = null
  }]

  scopes = [{
    name = null
    type = null
  }]
}

top

Variables

variable "auth_database_name" {
  description = "(optional)"
  type        = string
  default     = null
}

variable "aws_iam_type" {
  description = "(optional)"
  type        = string
  default     = null
}

variable "database_name" {
  description = "(optional)"
  type        = string
  default     = null
}

variable "password" {
  description = "(optional)"
  type        = string
  default     = null
}

variable "project_id" {
  description = "(required)"
  type        = string
}

variable "username" {
  description = "(required)"
  type        = string
}

variable "x509_type" {
  description = "(optional)"
  type        = string
  default     = null
}

variable "labels" {
  description = "nested block: NestingSet, min items: 0, max items: 0"
  type = set(object(
    {
      key   = string
      value = string
    }
  ))
  default = []
}

variable "roles" {
  description = "nested block: NestingSet, min items: 1, max items: 0"
  type = set(object(
    {
      collection_name = string
      database_name   = string
      role_name       = string
    }
  ))
}

variable "scopes" {
  description = "nested block: NestingSet, min items: 0, max items: 0"
  type = set(object(
    {
      name = string
      type = string
    }
  ))
  default = []
}

top

Resource

resource "mongodbatlas_database_user" "this" {
  # auth_database_name - (optional) is a type of string
  auth_database_name = var.auth_database_name
  # aws_iam_type - (optional) is a type of string
  aws_iam_type = var.aws_iam_type
  # database_name - (optional) is a type of string
  database_name = var.database_name
  # password - (optional) is a type of string
  password = var.password
  # project_id - (required) is a type of string
  project_id = var.project_id
  # username - (required) is a type of string
  username = var.username
  # x509_type - (optional) is a type of string
  x509_type = var.x509_type

  dynamic "labels" {
    for_each = var.labels
    content {
      # key - (optional) is a type of string
      key = labels.value["key"]
      # value - (optional) is a type of string
      value = labels.value["value"]
    }
  }

  dynamic "roles" {
    for_each = var.roles
    content {
      # collection_name - (optional) is a type of string
      collection_name = roles.value["collection_name"]
      # database_name - (optional) is a type of string
      database_name = roles.value["database_name"]
      # role_name - (optional) is a type of string
      role_name = roles.value["role_name"]
    }
  }

  dynamic "scopes" {
    for_each = var.scopes
    content {
      # name - (optional) is a type of string
      name = scopes.value["name"]
      # type - (optional) is a type of string
      type = scopes.value["type"]
    }
  }

}

top

Outputs

output "id" {
  description = "returns a string"
  value       = mongodbatlas_database_user.this.id
}

output "this" {
  value = mongodbatlas_database_user.this
}

top