Skip to content
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

Merged
merged 4 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fixed some issues based on PR comments
  • Loading branch information
TomerHeber committed Dec 2, 2024
commit 7976db510e9197b84247401aaf0f77bedfaee290
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ tf

dist/

venv
venv
3 changes: 2 additions & 1 deletion azapi/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# azapi

Utility for parsing Microsoft's azapi resource-tag tables, to locate all resources that can be tagged.
Utility for parsing Microsoft's azapi resource-tag tables, to locate all resources that can be tagged.
For more information check: https://github.com/env0/terratag/issues/209

```bash
python3 -m venv venv
Expand Down
5 changes: 3 additions & 2 deletions internal/providers/providers.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ func isSimpleStringLiteral(tokens hclwrite.Tokens) (string, bool) {
return "", false
}

func azureTypeIsTaggable(resource hclwrite.Block) bool {
// For more details check: https://github.com/env0/terratag/issues/209
func isAzureTypeTaggable(resource hclwrite.Block) bool {
typeAttr := resource.Body().GetAttribute("type")

if typeAttr == nil {
Expand Down Expand Up @@ -138,7 +139,7 @@ func IsSupportedResource(resourceType string, resource hclwrite.Block) bool {
return false
}

if strings.HasPrefix(resourceType, "azapi_") && !azureTypeIsTaggable(resource) {
if strings.HasPrefix(resourceType, "azapi_") && !isAzureTypeTaggable(resource) {
return false
}

Expand Down
Loading