Terraform resource: null resource

From wikieduonline
Jump to navigation Jump to search


    # An example resource that does nothing.
    resource "null_resource" "example" {
      triggers = {
        value = "A example resource that does nothing!"
      }
    }

Grok

resource "null_resource" "fetch_threshold" {
 provisioner "local-exec" {
   command = "psql -h <your-postgresql-host> -U <your-username> -d <your-database> -c \"SELECT threshold_value FROM thresholds WHERE metric_name = 'example_metric';\" > threshold.txt"
 }
}
data "local_file" "threshold" {
 filename = "threshold.txt"
 depends_on = [null_resource.fetch_threshold]
}


resource "null_resource" "tags_as_list_of_maps" {


  • terraform_data is a new builtin managed resource type, which can replace the use of null_resource, and can store data of any type [GH-31757]

See also[edit]

Advertising: