Skip to content

Commit 45e41a7

Browse files
committed
fix: implement remarks
1 parent 688e66b commit 45e41a7

File tree

3 files changed

+11
-15
lines changed

3 files changed

+11
-15
lines changed

docs/rules/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,15 @@ These rules enforce best practices and naming conventions:
8080
|[aws_security_group_rule_deprecated](aws_security_group_rule_deprecated.md)|Disallow using `aws_security_group_rule` resource||
8181
|[aws_provider_missing_default_tags](aws_provider_missing_default_tags.md)|Require specific tags for all AWS providers default tags||
8282

83+
### Removing secrets from state
84+
85+
These rules recommend best practices to keep sensitive information from state:
86+
87+
|Rule|Description|Enabled by default|
88+
| --- | --- | --- |
89+
|[aws_ephemeral_resources](aws_ephemeral_resources.md)|Recommends using available ephemeral resources instead of the original data source. This is only valid for Terraform v1.10+.||
90+
|[aws_write_only_arguments](aws_write_only_arguments.md)|Recommends using available write-only arguments instead of the original sensitive attribute. This is only valid for Terraform v1.11+.||
91+
8392
### SDK-based Validations
8493

8594
700+ rules based on the aws-sdk validations are also available:

rules/ephemeral/aws_ephemeral_resources.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,12 @@ func (r *AwsEphemeralResourcesRule) Check(runner tflint.Runner) error {
5151
}
5252

5353
for _, resource := range resources.Blocks {
54-
if err := runner.EmitIssueWithFix(
54+
if err := runner.EmitIssue(
5555
r,
5656
fmt.Sprintf("\"%s\" is a non-ephemeral data source, which means that all (sensitive) attributes are stored in state. Please use ephemeral resource \"%s\" instead.", resourceType, resourceType),
5757
resource.TypeRange,
58-
func(f tflint.Fixer) error {
59-
return f.ReplaceText(resource.TypeRange, "ephemeral")
60-
},
6158
); err != nil {
62-
return fmt.Errorf("failed to call EmitIssueWithFix(): %w", err)
59+
return fmt.Errorf("failed to call EmitIssue(): %w", err)
6360
}
6461
}
6562
}

rules/ephemeral/aws_ephemeral_resources_test.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@ data "aws_eks_cluster_auth" "test" {
3131
},
3232
},
3333
},
34-
Fixed: `
35-
ephemeral "aws_eks_cluster_auth" "test" {
36-
}
37-
`,
3834
},
3935
}
4036

@@ -48,11 +44,5 @@ ephemeral "aws_eks_cluster_auth" "test" {
4844
t.Fatalf("Unexpected error occurred: %s", err)
4945
}
5046
helper.AssertIssues(t, tc.Expected, runner.Issues)
51-
52-
want := map[string]string{}
53-
if tc.Fixed != "" {
54-
want[filename] = tc.Fixed
55-
}
56-
helper.AssertChanges(t, want, runner.Changes())
5747
}
5848
}

0 commit comments

Comments
 (0)