yor icon indicating copy to clipboard operation
yor copied to clipboard

Provide a list of supported Terraform Provider.

Open dirsigler opened this issue 2 years ago • 4 comments

Is your feature request related to a problem? Please describe. I wanted to try Yor out for personal projects and found out, that the Terraform provider I use are as it seems not supported to run Yor against it. For example I have a K3S Cluster at Civo or some development machines at Scaleway. As it seems DigitalOcean is also not supported - at least I don't receive any errors or recommended tags by Yor.

Describe the solution you'd like I would like to have some kind of overview about which Providers are supported or even in detail which terraform resources for the providers are supported. Maybe there is a way to add this to the Website or this GitHub Repository.

Describe alternatives you've considered An additional idea would be to maybe autodetect if the current Terraform provider is support by Yor, so the CLI would just spit out "Yeah sorry I found that you want to create a DigitalOcean resource, but we don't support DigitalOcean yet".

Additional context

Here you can see, that my GCP project is the only one which finds resources which can be updated. Output of a GCP project:

terraform providers && yor tag -d .

Providers required by configuration:
.
├── provider[registry.terraform.io/hashicorp/random]
└── provider[registry.terraform.io/hashicorp/google] 3.75.0

  __    __
  \ \  / /
   \ \/ /___  _  ____
    \  /  _ \| |/  __|
    | |  |_| |   /
    |_|\____/|__|v0.1.85
 Yor Findings Summary
 Scanned Resources:       7
 New Resources Traced:    2
 Updated Resources:       0

New Resources Traced (2):
[...]

Output of a Scaleway project:

terraform providers && yor tag -d .

Providers required by configuration:
.
├── provider[registry.terraform.io/scaleway/scaleway] ~> 2.1
└── provider[registry.terraform.io/integrations/github] ~> 4.0

Providers required by state:

    provider[registry.terraform.io/integrations/github]

    provider[registry.terraform.io/scaleway/scaleway]

2021/07/28 12:08:55 [WARNING] failed to parse terraform block because failed to find tags attribute name for resource type scaleway_account_ssh_key
2021/07/28 12:08:55 [WARNING] failed to parse terraform block because failed to find tags attribute name for resource type scaleway_vpc_private_network
2021/07/28 12:08:55 [WARNING] failed to parse terraform block because failed to find tags attribute name for resource type scaleway_instance_ip
2021/07/28 12:08:55 [WARNING] failed to parse terraform block because failed to find tags attribute name for resource type scaleway_instance_ip_reverse_dns
2021/07/28 12:08:55 [WARNING] failed to parse terraform block because failed to find tags attribute name for resource type scaleway_instance_security_group
2021/07/28 12:08:55 [WARNING] failed to parse terraform block because failed to find tags attribute name for resource type scaleway_instance_security_group_rules
2021/07/28 12:08:55 [WARNING] failed to parse terraform block because failed to find tags attribute name for resource type scaleway_instance_server
  __    __
  \ \  / /
   \ \/ /___  _  ____
    \  /  _ \| |/  __|
    | |  |_| |   /
    |_|\____/|__|v0.1.85
 Yor Findings Summary
 Scanned Resources:       9
 New Resources Traced:    0
 Updated Resources:       0

Output of a DigitalOcean project:

terraform providers && yor tag -d .

Providers required by configuration:
.
└── provider[registry.terraform.io/digitalocean/digitalocean] 2.6.0

2021/07/28 12:04:08 [WARNING] failed to parse terraform block because failed to find tags attribute name for resource type digitalocean_droplet
2021/07/28 12:04:08 [WARNING] failed to parse terraform block because failed to find tags attribute name for resource type digitalocean_firewall
  __    __
  \ \  / /
   \ \/ /___  _  ____
    \  /  _ \| |/  __|
    | |  |_| |   /
    |_|\____/|__|v0.1.85
 Yor Findings Summary
 Scanned Resources:       5
 New Resources Traced:    0
 Updated Resources:       0

dirsigler avatar Jul 28 '21 10:07 dirsigler

Hi @dirsigler !

We support the 5 official cloud providers terraform supports - AWS, GCP, Azure, OCI & AliCloud

nimrodkor avatar Aug 11 '21 15:08 nimrodkor

Thank you for the response! I already looked into the code but couldn't figure out where to add support for other cloud provider. Else I would raise something myself😞

dirsigler avatar Aug 11 '21 16:08 dirsigler

Cool, we'd love a contribution on this! https://github.com/bridgecrewio/yor/blob/caec4ffddd722adeaa57e98ce892f0520a29435e/src/terraform/structure/terraform_parser.go#L28

nimrodkor avatar Aug 12 '21 06:08 nimrodkor

@nimrodkor i would love to work on this . Do i need to just add the provider to the above mentioned line ?

ashish-patwal avatar Oct 15 '21 13:10 ashish-patwal

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.

stale[bot] avatar Feb 05 '23 19:02 stale[bot]

I just tried yor and ran into the same problem. I have a repo with a mix of supported and unsupported resources. Unfortunately, yor does not provide tags for the supported resources in this case:

yor tag -d . --dry-run
2023/07/10 11:27:30 [WARNING] failed to parse terraform block because failed to find tags attribute name for resource type kubernetes_cluster_role_binding_v1
2023/07/10 11:27:30 [WARNING] failed to parse terraform block because failed to find tags attribute name for resource type kubernetes_secret_v1
2023/07/10 11:27:30 [WARNING] failed to parse terraform block because failed to find tags attribute name for resource type kubernetes_namespace_v1
2023/07/10 11:27:30 [WARNING] failed to parse terraform block because failed to find tags attribute name for resource type helm_release
2023/07/10 11:27:30 [WARNING] failed to parse terraform block because failed to find tags attribute name for resource type kubernetes_namespace_v1
2023/07/10 11:27:30 [WARNING] failed to parse terraform block because failed to find tags attribute name for resource type helm_release
  __    __
  \ \  / /
   \ \/ /___  _  ____
    \  /  _ \| |/  __|
    | |  |_| |   /
    |_|\____/|__|v
 Yor Findings Summary
 Scanned Resources:	  109
 New Resources Traced: 	  0
 Updated Resources:	  0

But the module contains for example an azurerm_resource_group which gets tagged in a pure azurerm module.

Is there something I can do to make it work for the supported resources?

And I have the same question about contributing: Is it just a matter of adding a terraform provider to label name mapping in the code shown in https://github.com/bridgecrewio/yor/issues/169#issuecomment-897386640 ?

TheKangaroo avatar Jul 10 '23 09:07 TheKangaroo