VladRassokhin/intellij-hcl

`index` seems to be marked as returning bool instead of number

G-Rath opened this issue · 1 comments

Thank you for opening an issue.
In this template paragraph text could be removed, however please retain headers.

Prerequisites

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

Installation details

  • IDE version (Help->About->Copy to Clipboard)
    • in details block below
  • intellij-hcl plugin version (Settings->Plugins)
    • 0.7.14
  • Terraform version (terraform -v)
    • 1.0.3
IDE version
IntelliJ IDEA 2021.2.2 (Ultimate Edition)
Build #IU-212.5284.40, built on September 14, 2021
Licensed to Gareth Jones
Subscription is active until June 21, 2022.
Runtime version: 11.0.12+7-b1504.28 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 10 10.0
GC: ParNew, ConcurrentMarkSweep
Memory: 2988M
Cores: 12
Registry: ide.remote.interpreters.rsync.enabled.on.windows=true, show.affected.tests.in.changelists=true
Non-Bundled Plugins: Statistic (4.1.7), org.sylfra.idea.plugins.linessorter (1.0.1), org.toml.lang (0.2.155.4114-212), com.jetbrains.plugins.ini4idea (212.4746.57), com.alayouni.ansiHighlight (1.2.4), lermitage.intellij.battery.status (1.19.201), CMD Support (1.0.5), net.seesharpsoft.intellij.plugins.csv (2.17.1), com.intellij.ideolog (203.0.27.0), name.kropp.intellij.makefile (212.4746.52), com.sburlyaev.terminal.plugin (0.4.4), com.intellij.javafx (1.0.3), Dummy Text Generator (1.2.0), Key Promoter X (2021.2), com.intellij.plugins.watcher (212.5080.8), org.intellij.plugins.hcl (0.7.14), PsiViewer (212-SNAPSHOT), com.intellij.apacheConfig (212.4746.57), uk.co.ben-gibson.remote.repository.mapper (3.3.5), mobi.hsz.idea.gitignore (4.2.0), net.vektah.codeglance (1.5.4), AWSCloudFormation (212.4746.57), org.jetbrains.plugins.go-template (212.4746.52), org.jetbrains.plugins.slim (212.5080.8), org.intellij.plugins.postcss (212.4746.57), com.intellij.kubernetes (212.5284.17), org.elixir_lang (11.13.0), com.perl5 (2021.2), com.intellij.plugin.adernov.powershell (2.0.7), org.jetbrains.plugins.vagrant (212.4746.57), String Manipulation (8.15.203.000.3), mdx.js (1.2.212), jones.restarteslintaction.restart-eslint-action (0.0.1), com.intellij.lang.jsgraphql (3.0.0), com.dmarcotte.handlebars (212.4746.57), com.intellij.plugins.webcomponents (212.4746.57), com.jetbrains.lang.ejs (212.4746.57), org.jetbrains.plugins.node-remote-interpreter (212.5080.8), Dart (212.5284.31), io.flutter (60.1.4), com.intellij.plugins.html.instantEditing (212.4746.57), com.jetbrains.php (212.5284.49), com.jetbrains.twig (212.4746.57), com.kalessil.phpStorm.phpInspectionsEA (4.0.6.4), net.king2500.plugins.PhpAdvancedAutoComplete (1.1.0), com.raket.silverstripe (0.9.2.0), com.jetbrains.php.blade (212.5080.8), de.espend.idea.laravel (0.15.4), org.jetbrains.plugins.phpstorm-remote-interpreter (212.4746.52), org.jetbrains.plugins.phpstorm-docker (212.4746.52), com.jetbrains.php.wordPress (212.4746.52), com.jetbrains.php.behat (212.4746.52), org.jetbrains.plugins.ruby (212.5284.19), jones.foldcallblocks.fold-call-blocks (0.0.7-beta), org.jetbrains.plugins.ruby-chef (212.5080.8), intellij.prettierJS (212.5080.8), org.jetbrains.plugins.vue (212.5284.22), cucumber-javascript (212.4746.57), com.deadlock.scsyntax (212.4746.57), com.jetbrains.plugins.jade (212.5080.8), org.jetbrains.plugins.go (212.5284.31), Pythonid (212.5284.44), ru.meanmail.plugin.requirements (2021.4.1-212), aws.toolkit (1.32-212), org.jetbrains.kotlin (212-1.5.31-release-546-IJ4638.7), ru.adelf.idea.dotenv (2021.3.0.212), org.jetbrains.plugins.phpstorm-wsl (212.5080.8)
Kotlin: 212-1.5.31-release-546-IJ4638.7

Terraform Configuration Files

resource "aws_subnet" "load_balancer" {
  for_each = toset(data.aws_availability_zones.available.names)

  vpc_id            = aws_vpc.main.id
  availability_zone = each.key
  cidr_block        = "${var.vpc_ip_range_prefix}.${96 + index(data.aws_availability_zones.available.names, each.key) * 16}.0/20"
}

Expected Behavior

No error

Actual Behavior

The index function call is marked in red, with the message "Number expected instead of bool".

image

I think the issue is with the index function rather than the arguments as if I remove those (e.g. have just index()) the error remains.

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. Have a .tf file with the contents shown above
  2. Open in IntelliJ

This started happening in the new versions that were released this month - I think starting with 0.7.11, but it could have been introduced in a later version. It was definitely not happening before 0.7.11 :)

Fixed in upcoming update (0.7.15)