-
Notifications
You must be signed in to change notification settings - Fork 360
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for Terraform v1.10 (#2178)
* Bump tflint-plugin-sdk to v0.22.0 * Add `ephemeralasnull` function Follow up of hashicorp/terraform#35363 Follow up of hashicorp/terraform#35652 * Introduce ephemeral input variables Follow up of hashicorp/terraform#35273 Follow up of hashicorp/terraform#35985 Terraform throws an error if you use ephemeral values for the count meta-argument, but TFLint does not. This is because the reason for throwing an error is that plan cannot have ephemeral values, which is not an issue in the context of static analysis. In the future, we can throw an error if we need to match this behavior. * Functions that allow marks must also deal with unknown values Follow up of hashicorp/terraform#35985 * Add `terraform.applying` symbol Follow up of hashicorp/terraform@7c928fc * Introduce ephemeral resources Follow up of hashicorp/terraform#35727 Follow up of hashicorp/terraform#35728 Ephemeral resource addresses are like resources in that they always resolve to unknown values, but they differ in that they are marked as ephemeral, which can have a subtle effect on the return value of the ephemeralasnull function. * `issensitive` must return unknown for unknown args without `sensitive` Follow up of hashicorp/terraform#36012 * Fix `templatefile` function for unknown/marked values Follow up of hashicorp/terraform#36118 Follow up of hashicorp/terraform#36127 * Update collections to use for-range method Follow up of hashicorp/terraform#35818 * Include context when variable default has nested problem Follow up of hashicorp/terraform#35465 * Allow marked values in dynamic block `for_each` Follow up of hashicorp/hcl#679 Previously, for_each in dynamic blocks did not allow marked values such as sensitive. However, hashicorp/hcl#679 now supports this by propagating the marks to expanded children. The reason behind this is to add a new mark called "ephemeral", so we'll pull the changes to support Terraform 1.10. Note that tfhcl's dynamic block support has incomplete mark propagation since marked values resolve to unknown values. This is because in the past the marked values could not be sent over the wire protocol, and may be fixed in the near future. * Do not return ephemeral values to unsupported plugins Because ephemeral values are likely to contain secrets, return ErrSensitive for plugins that do not support it to prevent unintended disclosure. * Add E2E tests for ephemeral values and marked dynamic blocks * Update Terraform compatibility guide
- Loading branch information
Showing
40 changed files
with
1,126 additions
and
222 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
variable "no_marked" { | ||
default = "t2.micro" | ||
} | ||
|
||
variable "sensitive" { | ||
sensitive = true | ||
default = "t2.micro" | ||
} | ||
|
||
variable "ephemeral" { | ||
ephemeral = true | ||
default = "t2.micro" | ||
} | ||
|
||
variable "marked_set" { | ||
sensitive = true | ||
default = [true] | ||
} | ||
|
||
resource "aws_instance" "no_marked" { | ||
instance_type = var.no_marked | ||
} | ||
|
||
resource "aws_instance" "sensitive" { | ||
instance_type = var.sensitive | ||
} | ||
|
||
resource "aws_instance" "ephemeral" { | ||
instance_type = var.ephemeral | ||
} | ||
|
||
resource "aws_s3_bucket" "main" { | ||
dynamic "lifecycle_rule" { | ||
for_each = var.marked_set | ||
|
||
content { | ||
enabled = lifecycle_rule.value | ||
} | ||
} | ||
|
||
dynamic "lifecycle_rule" { | ||
for_each = var.marked_set | ||
|
||
content { | ||
enabled = true | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
{ | ||
"issues": [ | ||
{ | ||
"rule": { | ||
"name": "aws_instance_example_type", | ||
"severity": "error", | ||
"link": "" | ||
}, | ||
"message": "instance type is t2.micro", | ||
"range": { | ||
"filename": "main.tf", | ||
"start": { | ||
"line": 21, | ||
"column": 19 | ||
}, | ||
"end": { | ||
"line": 21, | ||
"column": 32 | ||
} | ||
}, | ||
"callers": [] | ||
}, | ||
{ | ||
"rule": { | ||
"name": "aws_s3_bucket_example_lifecycle_rule", | ||
"severity": "error", | ||
"link": "" | ||
}, | ||
"message": "`lifecycle_rule` block found", | ||
"range": { | ||
"filename": "main.tf", | ||
"start": { | ||
"line": 33, | ||
"column": 3 | ||
}, | ||
"end": { | ||
"line": 33, | ||
"column": 27 | ||
} | ||
}, | ||
"callers": [] | ||
}, | ||
{ | ||
"rule": { | ||
"name": "aws_s3_bucket_example_lifecycle_rule", | ||
"severity": "error", | ||
"link": "" | ||
}, | ||
"message": "`lifecycle_rule` block found", | ||
"range": { | ||
"filename": "main.tf", | ||
"start": { | ||
"line": 41, | ||
"column": 3 | ||
}, | ||
"end": { | ||
"line": 41, | ||
"column": 27 | ||
} | ||
}, | ||
"callers": [] | ||
}, | ||
{ | ||
"rule": { | ||
"name": "aws_s3_bucket_example_lifecycle_rule", | ||
"severity": "error", | ||
"link": "" | ||
}, | ||
"message": "`enabled` attribute found: true", | ||
"range": { | ||
"filename": "main.tf", | ||
"start": { | ||
"line": 45, | ||
"column": 17 | ||
}, | ||
"end": { | ||
"line": 45, | ||
"column": 21 | ||
} | ||
}, | ||
"callers": [] | ||
} | ||
], | ||
"errors": [] | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.