Skip to content

Latest commit

 

History

History
129 lines (102 loc) · 2.08 KB

digitalocean_images.md

File metadata and controls

129 lines (102 loc) · 2.08 KB

digitalocean_images

back

Index

Terraform

terraform {
  required_providers {
    digitalocean = ">= 2.7.0"
  }
}

top

Example Usage

module "digitalocean_images" {
  source = "./modules/digitalocean/d/digitalocean_images"


  filter = [{
    all      = null
    key      = null
    match_by = null
    values   = []
  }]

  sort = [{
    direction = null
    key       = null
  }]
}

top

Variables

variable "filter" {
  description = "nested block: NestingSet, min items: 0, max items: 0"
  type = set(object(
    {
      all      = bool
      key      = string
      match_by = string
      values   = list(string)
    }
  ))
  default = []
}

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

top

Datasource

data "digitalocean_images" "this" {

  dynamic "filter" {
    for_each = var.filter
    content {
      # all - (optional) is a type of bool
      all = filter.value["all"]
      # key - (required) is a type of string
      key = filter.value["key"]
      # match_by - (optional) is a type of string
      match_by = filter.value["match_by"]
      # values - (required) is a type of list of string
      values = filter.value["values"]
    }
  }

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

}

top

Outputs

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

output "images" {
  description = "returns a list of object"
  value       = data.digitalocean_images.this.images
}

output "this" {
  value = digitalocean_images.this
}

top