opentofu/internal/command/testdata/fmt/general_out.tf
Martin Atkins ffe056bacb Move command/ to internal/command/
This is part of a general effort to move all of Terraform's non-library
package surface under internal in order to reinforce that these are for
internal use within Terraform only.

If you were previously importing packages under this prefix into an
external codebase, you could pin to an earlier release tag as an interim
solution until you've make a plan to achieve the same functionality some
other way.
2021-05-17 14:09:07 -07:00

54 lines
1.3 KiB
HCL

# This test case is intended to cover many of the main formatting
# rules of "terraform fmt" at once. It's fine to add new stuff in
# here, but you can also add other _in.tf/_out.tf pairs in the
# same directory if you want to test something complicated that,
# for example, requires specific nested context.
#
# The input file of this test intentionally has strange whitespace
# alignment, because the goal is to see the fmt command fix it.
# If you're applying batch formatting to all .tf files in the
# repository (or similar), be sure to skip this one to avoid
# invalidating the test.
terraform {
required_providers {
foo = { version = "1.0.0" }
barbaz = {
version = "2.0.0"
}
}
}
variable "instance_type" {
}
resource "foo_instance" "foo" {
instance_type = var.instance_type
}
resource "foo_instance" "bar" {
instance_type = "${var.instance_type}-2"
}
resource "foo_instance" "baz" {
instance_type = "${var.instance_type}${var.instance_type}"
beep "boop" {}
beep "blep" {
thingy = var.instance_type
}
}
provider "" {
}
locals {
name = (contains(["foo"], var.my_var) ? "${var.my_var}-bar" :
contains(["baz"], var.my_var) ? "baz-${var.my_var}" :
file("ERROR: unsupported type ${var.my_var}"))
wrapped = (var.my_var == null ? 1 :
var.your_var == null ? 2 :
3)
}