mirror of
https://github.com/opentofu/opentofu.git
synced 2025-01-16 11:42:58 -06:00
ffe056bacb
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.
54 lines
1.3 KiB
HCL
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)
|
|
}
|