VladRassokhin / intellij-hcl

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

`Unresolved reference arn` for `arn` member in `aws_codeartifact_domain` and `aws_codeartifact_repository` objects #322

Closed ivancho1707 closed 3 years ago

ivancho1707 commented 3 years ago

Prerequisites

Installation details

Terraform Configuration Files

# Make a codeartifact domain and attach a repository to it
resource "aws_codeartifact_domain" "a_certain_code_domain" {
  domain         = "a-certain-code-domain"
}

resource "aws_codeartifact_repository" "a_certain_code_repository" {
  repository = "a-certain-code-repository"
  domain     = aws_codeartifact_domain.a_certain_code_domain.domain
}

# Now try to use the arn of the above generated resources, for instance for a iam policy
resource "aws_iam_policy" "a_certain_attached_policy" {
  name        = "CodeBuildBasePolicyForACertainModule"
  policy = jsonencode(
  {
    Version: "2012-10-17",
    Statement: [
      {
        Effect: "Allow",
        Action: [
           "codeartifact:GetAuthorizationToken",
           "codeartifact:GetRepositoryEndpoint",
        ]
        Resource: [
           aws_codeartifact_domain.a_certain_code_domain.arn,   # [!] Unresolved reference arn 
           aws_codeartifact_repository.a_certain_code_repository.arn  # [!] Unresolved reference arn 
        ]
     }
   ]
 })
}

Exception

None

Expected Behavior

Actual Behavior

What actually happened? HCL language support plugin prompts an error Unresolved reference arn for arn member in aws_codeartifact_domain and aws_codeartifact_repository objects even when the configuration is totally valid

Steps to Reproduce

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

  1. Setup a new project with the above terraform configuration
  2. Check code static analysis from HCL language support plugin, 2 errors prompted
DanielRadej commented 3 years ago

I have the same problem and this stands also for:

mush20 commented 3 years ago

+1

valentiniljaz commented 3 years ago

+1

vinujan59 commented 3 years ago

+1

VladRassokhin commented 3 years ago

Fixed in 0.7.11

isleshocky77 commented 3 years ago

@VladRassokhin Is this code committed somewhere and are the changelogs of the different releases documented somewhere?

VladRassokhin commented 3 years ago

@isleshocky77 plugin source code is closed, though terraform-metadata is open source. Changelog is available in "What's new" section on plugin page Issue was fixed purely by updating terraform-metadata and bundling new version in plugin.

isleshocky77 commented 3 years ago

@VladRassokhin Thanks.