Skip to content

Commit 30536d3

Browse files
authored
fix storage https_traffic_only_enabled (#32)
1 parent 9ccffd7 commit 30536d3

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

rules/azurerm_storage_account_https_traffic_only.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package rules
33
import (
44
"github.com/terraform-linters/tflint-plugin-sdk/hclext"
55
"github.com/terraform-linters/tflint-plugin-sdk/tflint"
6-
6+
77
"github.com/terraform-linters/tflint-ruleset-azurerm-security/project"
88
)
99

@@ -19,7 +19,7 @@ type AzurermStorageAccountHTTPSTrafficOnlyEnabled struct {
1919
func NewAzurermStorageAccountHTTPSTrafficOnlyEnabled() *AzurermStorageAccountHTTPSTrafficOnlyEnabled {
2020
return &AzurermStorageAccountHTTPSTrafficOnlyEnabled{
2121
resourceType: "azurerm_storage_account",
22-
attributeName: "https_traffic_only",
22+
attributeName: "https_traffic_only_enabled",
2323
}
2424
}
2525

@@ -60,7 +60,7 @@ func (r *AzurermStorageAccountHTTPSTrafficOnlyEnabled) Check(runner tflint.Runne
6060
// Emit an issue if the attribute does not exist
6161
runner.EmitIssue(
6262
r,
63-
"https_traffic_only is not defined and should be true",
63+
"https_traffic_only_enabled is not defined and should be true",
6464
resource.DefRange,
6565
)
6666
continue
@@ -70,7 +70,7 @@ func (r *AzurermStorageAccountHTTPSTrafficOnlyEnabled) Check(runner tflint.Runne
7070
if !val {
7171
runner.EmitIssue(
7272
r,
73-
"https_traffic_only should be true",
73+
"https_traffic_only_enabled should be true",
7474
attribute.Expr.Range(),
7575
)
7676
}

rules/azurerm_storage_account_https_traffic_only_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@ func Test_AzurermStorageAccountHTTPSTrafficOnlyEnabled(t *testing.T) {
1414
Expected helper.Issues
1515
}{
1616
{
17-
Name: "https_traffic_only disabled",
17+
Name: "https_traffic_only_enabled disabled",
1818
Content: `
1919
resource "azurerm_storage_account" "example" {
20-
https_traffic_only = false
20+
https_traffic_only_enabled = false
2121
}`,
2222
Expected: helper.Issues{
2323
{
2424
Rule: NewAzurermStorageAccountHTTPSTrafficOnlyEnabled(),
25-
Message: "https_traffic_only should be true",
25+
Message: "https_traffic_only_enabled should be true",
2626
Range: hcl.Range{
2727
Filename: "resource.tf",
28-
Start: hcl.Pos{Line: 3, Column: 26},
29-
End: hcl.Pos{Line: 3, Column: 31},
28+
Start: hcl.Pos{Line: 3, Column: 34},
29+
End: hcl.Pos{Line: 3, Column: 39},
3030
},
3131
},
3232
},
@@ -39,7 +39,7 @@ resource "azurerm_storage_account" "example" {
3939
Expected: helper.Issues{
4040
{
4141
Rule: NewAzurermStorageAccountHTTPSTrafficOnlyEnabled(),
42-
Message: "https_traffic_only is not defined and should be true",
42+
Message: "https_traffic_only_enabled is not defined and should be true",
4343
Range: hcl.Range{
4444
Filename: "resource.tf",
4545
Start: hcl.Pos{Line: 2, Column: 1},
@@ -49,10 +49,10 @@ resource "azurerm_storage_account" "example" {
4949
},
5050
},
5151
{
52-
Name: "https_traffic_only enabled",
52+
Name: "https_traffic_only_enabled enabled",
5353
Content: `
5454
resource "azurerm_storage_account" "example" {
55-
https_traffic_only = true
55+
https_traffic_only_enabled = true
5656
}`,
5757
Expected: helper.Issues{},
5858
},

0 commit comments

Comments
 (0)