-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat: azapi - not all resources support tags #210
Conversation
@@ -0,0 +1,42 @@ | |||
from io import StringIO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the utility for parsing the html file and building the white list.
once sync.Once | ||
) | ||
|
||
func getAzureTaggableResources() map[string]bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parse the csv file...
@@ -51,14 +84,65 @@ func GetTagIdByResource(resourceType string) string { | |||
return "" | |||
} | |||
|
|||
func IsSupportedResource(resourceType string) bool { | |||
func isSimpleStringLiteral(tokens hclwrite.Tokens) (string, bool) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extracts the 'type' value.
internal/providers/providers.go
Outdated
return "", false | ||
} | ||
|
||
func azureTypeIsTaggable(resource hclwrite.Block) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check based on the white list if the 'type' is taggable.
} | ||
|
||
resource "azapi_resource" "example4" { | ||
type = "Microsoft.App/containerApps/authConfigs@2024-03-01" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
authConfig isn't taggable.
} | ||
|
||
resource "azapi_resource" "example4" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should remain untaggable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All in all looks good
Left couple of thoughts ideas, LMK WDYT
Based on Microsoft's documentation a whitelist of resources was created.
Only azapi types (type field) in the white list will be tagged.
fixes #209