Skip to content

Commit

Permalink
add azurerm and azurestack to supported providers (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
roni-frantchi authored May 14, 2020
1 parent 61bd9d9 commit 0c55681
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions providers/providers.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ func getProviderByResource(resource hclwrite.Block) Provider {
return "aws"
} else if strings.HasPrefix(resourceType, "google_") {
return "gcp"
} else if strings.HasPrefix(resourceType, "azurerm_") || strings.HasPrefix(resourceType, "azurestack_") {
return "azure"
}

return ""
Expand All @@ -21,7 +23,7 @@ func IsTaggableByAttribute(resource hclwrite.Block, attribute string) bool {
provider := getProviderByResource(resource)
tagBlockId := GetTagBlockIdByResource(resource)

if (provider == "aws" || provider == "gcp") && attribute == tagBlockId {
if (provider != "") && attribute == tagBlockId {
return true
}
return false
Expand All @@ -30,7 +32,7 @@ func IsTaggableByAttribute(resource hclwrite.Block, attribute string) bool {
func GetTagBlockIdByResource(resource hclwrite.Block) string {
provider := getProviderByResource(resource)

if provider == "aws" {
if provider == "aws" || provider == "azure" {
return "tags"
} else if provider == "gcp" {
return "labels"
Expand All @@ -49,6 +51,8 @@ func isSupportedProvider(provider Provider) bool {
return true
case "gcp":
return true
case "azure":
return true
default:
return false
}
Expand Down

0 comments on commit 0c55681

Please sign in to comment.