github.com/burmuley/terraform@v0.11.12-beta1/config/test-fixtures/basic-hcl2.tf (about)

     1  #terraform:hcl2
     2  
     3  terraform {
     4    required_version = "foo"
     5  
     6    backend "baz" {
     7      something = "nothing"
     8    }
     9  }
    10  
    11  variable "foo" {
    12    default     = "bar"
    13    description = "barbar"
    14  }
    15  
    16  variable "bar" {
    17      type = "string"
    18  }
    19  
    20  variable "baz" {
    21    type = "map"
    22  
    23    default = {
    24      key = "value"
    25    }
    26  }
    27  
    28  provider "aws" {
    29    access_key = "foo"
    30    secret_key = "bar"
    31    version    = "1.0.0"
    32  }
    33  
    34  provider "do" {
    35    api_key = var.foo
    36    alias   = "fum"
    37  }
    38  
    39  data "do" "simple" {
    40    foo      = "baz"
    41    provider = "do.foo"
    42  }
    43  
    44  data "do" "depends" {
    45    depends_on = ["data.do.simple"]
    46  }
    47  
    48  resource "aws_security_group" "firewall" {
    49    count    = 5
    50    provider = "another"
    51  }
    52  
    53  resource "aws_instance" "web" {
    54    ami = "${var.foo}"
    55    security_groups = [
    56      "foo",
    57      aws_security_group.firewall.foo,
    58    ]
    59  
    60    network_interface {
    61      device_index = 0
    62      description  = "Main network interface"
    63    }
    64  
    65    connection {
    66      default = true
    67    }
    68  
    69    provisioner "file" {
    70      source      = "foo"
    71      destination = "bar"
    72    }
    73  }
    74  
    75  locals {
    76    security_group_ids = aws_security_group.firewall.*.id
    77    web_ip = aws_instance.web.private_ip
    78  }
    79  
    80  locals {
    81    literal = 2
    82    literal_list = ["foo"]
    83    literal_map = {"foo" = "bar"}
    84  }
    85  
    86  resource "aws_instance" "db" {
    87    security_groups = aws_security_group.firewall.*.id
    88    VPC             = "foo"
    89  
    90    tags = {
    91      Name = "${var.bar}-database"
    92    }
    93  
    94    depends_on = ["aws_instance.web"]
    95  
    96    provisioner "file" {
    97      source      = "here"
    98      destination = "there"
    99  
   100      connection {
   101        default = false
   102      }
   103    }
   104  }
   105  
   106  output "web_ip" {
   107    value     = aws_instance.web.private_ip
   108    sensitive = true
   109  }
   110  
   111  output "web_id" {
   112    description = "The ID"
   113    value       = aws_instance.web.id
   114    depends_on  = ["aws_instance.db"]
   115  }
   116  
   117  atlas {
   118    name = "example/foo"
   119  }
   120  
   121  module "child" {
   122    source = "./baz"
   123  
   124    toasty = true
   125  }