diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d35db3d598..23e9198264 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -248,10 +248,15 @@ jobs: terraform_version: ${{ steps.config.outputs.terraform-version }} terraform_wrapper: false - - name: tflint + - name: Lint examples/${{ matrix.demo-folder }}/components/terraform uses: reviewdog/action-tflint@v1 with: github_token: ${{ secrets.github_token }} working_directory: examples/${{ matrix.demo-folder }}/components/terraform - flags: "--enable-rule=terraform_unused_declarations --disable-rule=terraform_typed_variables --recursive" + flags: >- + --enable-rule=terraform_unused_declarations + --disable-rule=terraform_typed_variables + --minimum-failure-severity=warning + --recursive + --config=${{ github.workspace }}/examples/.tflint.hcl fail_on_error: true diff --git a/examples/.tflint.hcl b/examples/.tflint.hcl new file mode 100644 index 0000000000..427121c3ef --- /dev/null +++ b/examples/.tflint.hcl @@ -0,0 +1,4 @@ +plugin "terraform" { + enabled = true + preset = "recommended" +} diff --git a/examples/demo-context/atmos.yaml b/examples/demo-context/atmos.yaml index 2c50b34fae..5a1bb7487b 100644 --- a/examples/demo-context/atmos.yaml +++ b/examples/demo-context/atmos.yaml @@ -33,4 +33,14 @@ logs: file: "/dev/stderr" level: Info - +commands: +- name: "test" + description: "Run all tests" + steps: + - atmos validate stacks + - atmos terraform plan demo -s acme-west-dev + - atmos terraform plan demo -s acme-west-staging + - atmos terraform plan demo -s acme-west-prod + - atmos terraform apply demo -s acme-west-dev -auto-approve + - atmos terraform apply demo -s acme-west-staging -auto-approve + - atmos terraform apply demo -s acme-west-prod -auto-approve diff --git a/examples/demo-context/components/terraform/petset/main.tf b/examples/demo-context/components/terraform/petset/main.tf index 691a898618..f175dbb99d 100644 --- a/examples/demo-context/components/terraform/petset/main.tf +++ b/examples/demo-context/components/terraform/petset/main.tf @@ -7,6 +7,9 @@ data "context_label" "this" { # Create tags based on the context. Add the value of the name label to the tags data "context_tags" "this" { + values = { + "type" = var.pet + } } module "pet_set" { diff --git a/examples/demo-context/components/terraform/petset/modules/instance/main.tf b/examples/demo-context/components/terraform/petset/modules/instance/main.tf index d41e826ca7..08788eb5e1 100644 --- a/examples/demo-context/components/terraform/petset/modules/instance/main.tf +++ b/examples/demo-context/components/terraform/petset/modules/instance/main.tf @@ -17,6 +17,7 @@ data "context_tags" "this" { locals { instance_types = { + "alien" = "👽" # Alien "ant" = "🐜" # Ant "dog" = "🐶" # Dog "cat" = "🐱" # Cat diff --git a/examples/demo-context/components/terraform/petset/outputs.tf b/examples/demo-context/components/terraform/petset/outputs.tf index 689790c68e..6a03b58041 100644 --- a/examples/demo-context/components/terraform/petset/outputs.tf +++ b/examples/demo-context/components/terraform/petset/outputs.tf @@ -16,3 +16,8 @@ output "label" { output "pet_set" { value = [for k, v in module.pet_set : v.name] } + +output "delimiter" { + description = "Delimiter used in the context" + value = data.context_config.this.delimiter +} diff --git a/examples/demo-context/components/terraform/petset/variables.tf b/examples/demo-context/components/terraform/petset/variables.tf index 51daaadb47..dc0e6c1ed8 100644 --- a/examples/demo-context/components/terraform/petset/variables.tf +++ b/examples/demo-context/components/terraform/petset/variables.tf @@ -1,5 +1,5 @@ variable "pet" { - description = "A list of pets to include in the PetSet" + description = "The type of instance to include in the PetSet" type = string default = "dog" } diff --git a/examples/demo-context/stacks/catalog/demo.yaml b/examples/demo-context/stacks/catalog/demo.yaml index 71ad571359..e55af898a3 100644 --- a/examples/demo-context/stacks/catalog/demo.yaml +++ b/examples/demo-context/stacks/catalog/demo.yaml @@ -8,4 +8,5 @@ components: context: values: name: petset - vars: {} + vars: + pet: "dog" diff --git a/examples/demo-context/stacks/deploy/_defaults.yaml b/examples/demo-context/stacks/deploy/_defaults.yaml index ee02f8eafb..5a4229d07b 100644 --- a/examples/demo-context/stacks/deploy/_defaults.yaml +++ b/examples/demo-context/stacks/deploy/_defaults.yaml @@ -25,6 +25,7 @@ terraform: required: true instance: {} component: {} + type: {} repo: {} stack: {} stack_file: {} diff --git a/examples/demo-context/stacks/deploy/prod/demo.yaml b/examples/demo-context/stacks/deploy/prod/demo.yaml index 03c7f05613..e8893c6c9a 100644 --- a/examples/demo-context/stacks/deploy/prod/demo.yaml +++ b/examples/demo-context/stacks/deploy/prod/demo.yaml @@ -18,4 +18,4 @@ components: type: real vars: size: 10 - type: "horse" + pet: "alien"