Skip to content
This repository has been archived by the owner on Mar 6, 2023. It is now read-only.

Variable value type warning on valid object #367

Open
5 tasks done
solarmosaic-kflorence opened this issue Dec 15, 2021 · 0 comments
Open
5 tasks done

Variable value type warning on valid object #367

solarmosaic-kflorence opened this issue Dec 15, 2021 · 0 comments

Comments

@solarmosaic-kflorence
Copy link

solarmosaic-kflorence commented Dec 15, 2021

Prerequisites

  • Ensure you have latest version of plugin installed
  • Search for possible issue duplicates

Installation details

  • IDE version (Help->About->Copy to Clipboard)
    IntelliJ IDEA 2021.2 (Ultimate Edition)
    Build #IU-212.4746.92, built on July 27, 2021
    Runtime version: 11.0.11+9-b1504.13 x86_64
    VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
    macOS 10.15.7
    GC: ParNew, ConcurrentMarkSweep
    Memory: 4029M
    Cores: 8
    Registry: scala.erase.compiler.process.jdk.once=false
    Non-Bundled Plugins: org.intellij.plugins.hcl (0.7.14), mobi.hsz.idea.gitignore (4.3.0), name.kropp.intellij.makefile (212.4746.52), org.toml.lang (0.2.155.4114-212), org.jetbrains.plugins.hocon (2021.1.0), intellij.prettierJS (212.4746.57), Pythonid (212.4746.96), org.jetbrains.plugins.go (212.4746.92), aws.toolkit (1.36-212), org.intellij.scala (2021.2.24), pro.bashsupport (2.0.4.212)
    Kotlin: 212-1.5.10-release-IJ4746.92
    
  • intellij-hcl plugin version (Settings->Plugins) 0.7.14
  • Terraform version (terraform -v) 1.1.0

Terraform Configuration Files

variable "build" {
  default = {
    compile = {
      artifacts = [
        {
          base_directory = null
          discard_paths  = null
          files          = ["**/*"]
          name           = null
        }
      ]
      build_commands         = ["sbt -Dsbt.log.noformat=true +compile"]
      docker_support_enabled = false
      description            = "Compile the project."
      name                   = "ScalaDoc"
      input_artifacts        = ["source"]
      output_artifacts       = ["compiled"]
      run_order              = 1
    }
    compile-doc = {
      artifacts              = []
      build_commands         = ["sbt -Dsbt.log.noformat=true +compile:doc"]
      docker_support_enabled = false
      description            = "Generate documentation."
      name                   = "ScalaDoc"
      input_artifacts        = ["compiled"]
      output_artifacts       = []
      run_order              = 1
    }
  }
  description = "Configuration for the CodeBuild validation project which are executed during the 'Build' stage of the pipeline."
  type = map(object({
    artifacts = list(object({
      base_directory = string
      discard_paths  = string
      files          = list(string)
      name           = string
    }))
    build_commands         = list(string)
    docker_support_enabled = bool
    description            = string
    name                   = string
    input_artifacts        = list(string)
    output_artifacts       = list(string)
    run_order              = number
  }))
}

Exception

Variable value type 'object({compile=object({artifacts=list(object({base_directory=null, discard_paths=null, files=list(string), name=null})), build_commands=list(string), description=string, docker_support_enabled=bool, input_artifacts=list(string), name=string, output_artifacts=list(string), run_order=number}), compile-doc=object({artifacts=list, build_commands=list(string), description=string, docker_support_enabled=bool, input_artifacts=list(string), name=string, output_artifacts=list, run_order=number})})' doesn't match default value type 'map(object({artifacts=list(object({base_directory=string, discard_paths=string, files=list(string), name=string})), build_commands=list(string), docker_support_enabled=bool, description=string, name=string, input_artifacts=list(string), output_artifacts=list(string), run_order=number}))'

It seems from the warning message that the inner types of the list() is not taken into account unless it has a value. Perhaps similar to #362

Expected Behavior

There should be no warning, as the default value is correct.

Actual Behavior

A warning is displayed in the editor and the default object is highlighted.

Screen Shot 2021-12-15 at 4 40 36 PM

Steps to Reproduce

Paste the above Terraform configuration into a Terraform file (e.g. variables.tf). If I update the default object to the following, the warning goes away:

default = {
  compile = {
    artifacts = [
      {
        base_directory = null
        discard_paths  = null
        files          = ["**/*"]
        name           = null
      }
    ]
    build_commands         = ["sbt -Dsbt.log.noformat=true +compile"]
    docker_support_enabled = false
    description            = "Compile the project."
    name                   = "ScalaDoc"
    input_artifacts        = ["source"]
    output_artifacts       = ["compiled"]
    run_order              = 1
  }
  compile-doc = {
    artifacts = [
      {
        base_directory = null
        discard_paths  = null
        files          = ["**/*"]
        name           = null
      }
    ]
    build_commands         = ["sbt -Dsbt.log.noformat=true +compile:doc"]
    docker_support_enabled = false
    description            = "Generate documentation."
    name                   = "ScalaDoc"
    input_artifacts        = ["compiled"]
    output_artifacts       = ["output"]
    run_order              = 1
  }
}

Notice that artifacts and output_artifacts both now have values inside of the lists.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant