VladRassokhin / intellij-hcl

HCL language support for IntelliJ platform based IDEs
Apache License 2.0
244 stars 47 forks source link

Plugin does not support aws_appmesh_virtual_gateway and aws_appmesh_gateway_route #323

Closed naishe closed 3 years ago

naishe commented 3 years ago

The plugin does not seem to support aws_appmesh_virtual_gateway and aws_appmesh_gateway_route.

  1. It does not suggest these modules in autocomplete Autocomplete does not work
  2. It shows unsupported block warning on valid blocks Wrong warnings

The examples are taken directly from https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/appmesh_virtual_gateway (latest, at the time of posting this issue the version was mentioned 3.26.0) The details are as follows:

Prerequisites

Installation details

Terraform Configuration Files

resource "aws_appmesh_virtual_gateway" "example" {
  name      = "example-virtual-gateway"
  mesh_name = "example-service-mesh"

  spec {
    listener {
      port_mapping {
        port     = 8080
        protocol = "http"
      }
    }
  }

  tags = {
    Environment = "test"
  }
}

Exception

It shows unknown block type for spec, listener, and port_mapping

Unknown block type spec

Expected Behavior

The autocomplete should work The warnings should not be shown

Actual Behavior

The autocomplete does not work Warnings are shown on valid blocks

Steps to Reproduce

Create a configuration using examples given in Terraform documentation for appmesh_virtual_gateway and appmesh_gateway_route

Observe the following:

  1. The auto-completion does not suggest these resources
  2. Valid blocks show warning as specified above
naishe commented 3 years ago

Continuing the thread, there are more places where the plugin does not work as intended. For example, this code exactly taken from the documentation has two issues:

resource "aws_appmesh_virtual_service" "admin_service" {
  mesh_name = aws_appmesh_mesh.mesh.id
  name = local.admin_service_dns
  spec {
    provider {
      virtual_node {
        virtual_node_name = aws_appmesh_virtual_node.admin_node.name
      }
    }
  }
}
  1. provider block does not come in autocomplete (nor any of the attributes within this tag)
  2. It wrongly shows it as error, as illustrated in the image below Screen Shot 2021-02-02 at 4 42 55 PM
naishe commented 3 years ago

@VladRassokhin sorry to bother, any idea?

haidaraM commented 3 years ago

For different providers resources, check this: https://github.com/VladRassokhin/intellij-hcl#terraform-external-metadata You need to build the schema manually.

naishe commented 3 years ago

For different providers resources, check this: https://github.com/VladRassokhin/intellij-hcl#terraform-external-metadata You need to build the schema manually.

Should it not work out of the box? This is not external meta data. This resource and properties are documented here so, like any other AWS resource the properties should auto complete and not show a warning without requiring the end user to do extra steps.

This project being closed sourced, I can't even pry open and see why is this the case.

haidaraM commented 3 years ago

The providers schemas is embeded with the plugin as the time the plugin is released. Since there is no new release of the plugin, if you want to have autocompletion for the new resources, you will need to do get the schemas manually or maybe use Terraform language server : https://github.com/hashicorp/terraform-ls/blob/main/docs/USAGE.md#intellij-ide

Otherwise, check my fork of the metadata that I update from time to time: https://github.com/haidaraM/terraform-metadata/tree/feat/updateProviders. You have the aws_appmesh_virtual_gateway there :-) Just follow the instructions and should work

VladRassokhin commented 3 years ago

Partially fixed in 0.7.11 Fix for aws_appmesh_virtual_service.spec.provider.virtual_node will be in next update (0.7.13)

VladRassokhin commented 3 years ago

Fixed in 0.7.13