Skip to content

Commit

Permalink
Add terraform.applying symbol
Browse files Browse the repository at this point in the history
  • Loading branch information
wata727 committed Dec 31, 2024
1 parent b604f6b commit d97f559
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions terraform/evaluator.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1

package terraform

import (
Expand Down Expand Up @@ -301,6 +304,10 @@ func (d *evaluationData) GetTerraformAttr(addr addrs.TerraformAttr, rng hcl.Rang
workspaceName := d.Meta.Env
return cty.StringVal(workspaceName), diags

case "applying":
// terraform.applying always returns false in TFLint
return cty.BoolVal(false).Mark(marks.Ephemeral), nil

case "env":
// Prior to Terraform 0.12 there was an attribute "env", which was
// an alias name for "workspace". This was deprecated and is now
Expand Down
7 changes: 7 additions & 0 deletions terraform/evaluator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,13 @@ variable "string_var" {
want: `cty.StringVal("default")`,
errCheck: neverHappend,
},
{
name: "terraform.applying",
expr: expr(`terraform.applying`),
ty: cty.Bool,
want: `cty.False.Mark(marks.Ephemeral)`,
errCheck: neverHappend,
},
{
name: "interpolation in string",
config: `
Expand Down

0 comments on commit d97f559

Please sign in to comment.