File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed
adapters/terraform/azure/storage Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -176,8 +176,10 @@ func adaptAccount(resource *terraform.Block) storage.Account {
176176 account .NetworkRules = append (account .NetworkRules , adaptNetworkRule (networkBlock ))
177177 }
178178
179- httpsOnlyAttr := resource .GetAttribute ("enable_https_traffic_only" )
180- account .EnforceHTTPS = httpsOnlyAttr .AsBoolValueOrDefault (true , resource )
179+ account .EnforceHTTPS = resource .GetFirstAttributeOf (
180+ "enable_https_traffic_only" ,
181+ "https_traffic_only_enabled" , // provider above version 4
182+ ).AsBoolValueOrDefault (true , resource )
181183
182184 // Adapt blob properties
183185 blobPropertiesBlock := resource .GetBlock ("blob_properties" )
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ import (
1616
1717 "github.com/aquasecurity/trivy/pkg/iac/terraform/context"
1818 iacTypes "github.com/aquasecurity/trivy/pkg/iac/types"
19+ "github.com/aquasecurity/trivy/pkg/set"
1920)
2021
2122type Block struct {
@@ -303,11 +304,18 @@ func (b *Block) GetAttributes() []*Attribute {
303304}
304305
305306func (b * Block ) GetAttribute (name string ) * Attribute {
306- if b == nil || b .hclBlock == nil {
307+ return b .GetFirstAttributeOf (name )
308+ }
309+
310+ func (b * Block ) GetFirstAttributeOf (names ... string ) * Attribute {
311+ if b == nil || b .hclBlock == nil || len (names ) == 0 {
307312 return nil
308313 }
314+
315+ nameSet := set .New (names ... )
316+
309317 for _ , attr := range b .attributes {
310- if attr .Name () == name {
318+ if ok := nameSet . Contains ( attr .Name ()); ok {
311319 return attr
312320 }
313321 }
You can’t perform that action at this time.
0 commit comments