-
Notifications
You must be signed in to change notification settings - Fork 124
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
Improving terraform taggable resources list #375
Conversation
It looks like bug in the latest go-git version (v5.7.0), I'll try to downgrade go-git version for schema repo and try again tomorrow. |
I was unable to downgrade the |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
please keep it open |
I have upgraded |
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.
great work, especially making the git dependency compatible with us again 💪
var TfTaggableResourceTypes []string | ||
|
||
func init() { | ||
linq.From(previousTaggableTypes(awsv4.Resources, isTaggableType, awsv2.Resources, awsv3.Resources, awsv4.Resources)). |
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.
linq.From(previousTaggableTypes(awsv4.Resources, isTaggableType, awsv2.Resources, awsv3.Resources, awsv4.Resources)). | |
linq.From(previousTaggableTypes(awsv4.Resources, isTaggableType, awsv2.Resources, awsv3.Resources)). |
it looks like you have aws4
twice in the line
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.
My bad...
|
||
var TfTaggableResourceTypes []string | ||
|
||
func init() { |
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.
do you know how long the initialization takes? this will be recreated each time the CLI is used or am I missing something?
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.
I'll do a benchmark so you can make the call based on that. I was thinking about converting the json marshal operation into a lazy load, but it wasn't my priority before. If you're not satisfied with the benchmark result, then I'll make the load to lazy load.
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.
Hi @gruebel I just recalled that we cannot boost the init
by lazy load since we need to filter out the resources that contains tags
. Here's the benchmark on my laptop and if you're not satisfied with it, maybe we can boost the load by code generate?:
goos: windows
goarch: amd64
pkg: github.com/bridgecrewio/yor/src/terraform/structure
cpu: 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz
BenchmarkInit
BenchmarkInit-8 246 5656524 ns/op
BenchmarkInit-8 270 4959608 ns/op
BenchmarkInit-8 211 5061141 ns/op
BenchmarkInit-8 249 4825400 ns/op
BenchmarkInit-8 310 3281290 ns/op
BenchmarkInit-8 396 3308266 ns/op
BenchmarkInit-8 387 3507547 ns/op
BenchmarkInit-8 358 3308801 ns/op
BenchmarkInit-8 357 3374912 ns/op
BenchmarkInit-8 360 3287701 ns/op
BenchmarkInit-8 396 3366633 ns/op
BenchmarkInit-8 386 3320744 ns/op
BenchmarkInit-8 391 5482833 ns/op
BenchmarkInit-8 213 4862594 ns/op
BenchmarkInit-8 285 3868470 ns/op
BenchmarkInit-8 303 3673442 ns/op
BenchmarkInit-8 354 3305469 ns/op
BenchmarkInit-8 338 3350286 ns/op
BenchmarkInit-8 387 3335693 ns/op
BenchmarkInit-8 358 3304018 ns/op
BenchmarkInit-8 361 3436961 ns/op
BenchmarkInit-8 350 3917158 ns/op
BenchmarkInit-8 332 3217946 ns/op
BenchmarkInit-8 388 3363009 ns/op
BenchmarkInit-8 348 3279345 ns/op
BenchmarkInit-8 367 3206369 ns/op
BenchmarkInit-8 391 3257789 ns/op
BenchmarkInit-8 368 3270909 ns/op
BenchmarkInit-8 352 3235348 ns/op
BenchmarkInit-8 386 3352852 ns/op
BenchmarkInit-8 318 3525487 ns/op
BenchmarkInit-8 362 3526662 ns/op
BenchmarkInit-8 333 3532842 ns/op
BenchmarkInit-8 376 3321541 ns/op
BenchmarkInit-8 356 3308681 ns/op
BenchmarkInit-8 360 3678722 ns/op
BenchmarkInit-8 367 3250190 ns/op
BenchmarkInit-8 364 3266191 ns/op
BenchmarkInit-8 363 3474205 ns/op
BenchmarkInit-8 340 3352039 ns/op
BenchmarkInit-8 338 3202551 ns/op
BenchmarkInit-8 340 3348379 ns/op
BenchmarkInit-8 320 3288201 ns/op
BenchmarkInit-8 374 3283416 ns/op
BenchmarkInit-8 338 3218595 ns/op
BenchmarkInit-8 376 3346400 ns/op
BenchmarkInit-8 368 3320164 ns/op
BenchmarkInit-8 316 3336018 ns/op
BenchmarkInit-8 326 3993416 ns/op
BenchmarkInit-8 302 3397222 ns/op
BenchmarkInit-8 342 3320784 ns/op
BenchmarkInit-8 344 3186624 ns/op
BenchmarkInit-8 327 3182577 ns/op
BenchmarkInit-8 373 3342972 ns/op
BenchmarkInit-8 358 3381648 ns/op
BenchmarkInit-8 357 3348296 ns/op
BenchmarkInit-8 355 3211068 ns/op
BenchmarkInit-8 331 3260557 ns/op
BenchmarkInit-8 348 3390506 ns/op
BenchmarkInit-8 358 3988988 ns/op
BenchmarkInit-8 376 3296542 ns/op
BenchmarkInit-8 367 3203626 ns/op
BenchmarkInit-8 330 3174616 ns/op
BenchmarkInit-8 378 3210405 ns/op
BenchmarkInit-8 346 3271160 ns/op
BenchmarkInit-8 358 3351525 ns/op
BenchmarkInit-8 339 3178830 ns/op
BenchmarkInit-8 285 3530353 ns/op
BenchmarkInit-8 330 3334848 ns/op
BenchmarkInit-8 386 3372618 ns/op
BenchmarkInit-8 333 3274653 ns/op
BenchmarkInit-8 355 3671500 ns/op
BenchmarkInit-8 322 3359247 ns/op
BenchmarkInit-8 366 3307886 ns/op
BenchmarkInit-8 343 3992340 ns/op
BenchmarkInit-8 358 3436902 ns/op
BenchmarkInit-8 384 3342238 ns/op
BenchmarkInit-8 342 3323672 ns/op
BenchmarkInit-8 357 3265490 ns/op
BenchmarkInit-8 372 3465086 ns/op
BenchmarkInit-8 380 3311641 ns/op
BenchmarkInit-8 333 3364876 ns/op
BenchmarkInit-8 369 3275553 ns/op
BenchmarkInit-8 393 3413220 ns/op
BenchmarkInit-8 310 3503894 ns/op
BenchmarkInit-8 331 3305068 ns/op
BenchmarkInit-8 393 3400776 ns/op
BenchmarkInit-8 357 3284698 ns/op
BenchmarkInit-8 364 4481733 ns/op
BenchmarkInit-8 307 3947393 ns/op
BenchmarkInit-8 333 3271755 ns/op
BenchmarkInit-8 241 6217576 ns/op
BenchmarkInit-8 361 3335206 ns/op
BenchmarkInit-8 343 3278905 ns/op
BenchmarkInit-8 355 3612213 ns/op
BenchmarkInit-8 348 3298262 ns/op
BenchmarkInit-8 390 3479846 ns/op
BenchmarkInit-8 406 3255017 ns/op
BenchmarkInit-8 355 3320015 ns/op
BenchmarkInit-8 349 3255885 ns/op
PASS
Process finished with the exit code 0
@gruebel A kindly ping, is there anything I can do to get this pr be merged? |
29cef68
to
81a5058
Compare
Hi @gruebel a kindly ping, I've rebased this pr with the latest main branch and upgraded the module's version. I saw |
Hello @nimrodkor @gruebel a kindly ping, I think this pr is ready for your review, and the update it brought is very important for some community users. Could we merge it? Thanks! |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
@rotemavni @gruebel @omryMen PTAL 🙏 |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
As #374 described, this pr change the static taggable resources list to a calculated list by using terraform-aws-schema / terraform-azurerm-schema / terraform-google-schema.
This pr also implemented the following logics:
azurerm_data_lake_analytics_account
was deprecated and deleted in AzureRM provider v3.0), is should still be taggable for backward compatibility.tags
argument was deprecated and deleted (e.g.:azurerm_log_analytics_linked_service
'stags
has been removed by this pr), it should not be taggable.tags
but with different type (map(string)
foraws
andazurerm
,set(string)
forgoogle
) should not be taggable. (e.g.:azurerm_api_management_property
)structure.unsupportedTerraformBlocks
should not be taggable.I was unable to generate schemas for
awsv0
,awsv1
,azurermv0
,azurermv1
,googlev0
,googlev1
, so the lowest major version for these three clouds isv2
. For now it supportsawsv2
,awsv3
,awsv4
,awsv5
,azurermv2
,azurermv3
,googlev2
,googlev3
,googlev4
. Once a new major version of provider has been released, there won't be new corresponding schema tag, we need update the schema repo to generate new package version for schema repo, and upgradeyor
's code to adapt with the new schema package.This pr contains some new unit tests to verify these logics. @nimrodkor Would you please give it a review? Thanks!