JetBrains / package-search-gradle-plugins

Gradle plugins for Docker, Terraform and Liquibase.
Apache License 2.0
32 stars 8 forks source link

terraformPlan fails every other time (with single lambda resource) #15

Closed blundell closed 2 years ago

blundell commented 2 years ago

I'm using the lambda integration from the README, it creates a resource and its the only resource in the whole project.

> Task :my-root-project:my-terraform-project:terraformMainPlan FAILED
╷ IDLE
│ Error: Reference to undeclared input variable
│ 
│   on project-rbc.tf line 98, in resource "aws_lambda_function" "my_lambda":
│   98:   filename = "${var.resources.myLambda_jar.path}"
│ 
│ An input variable with the name "resources" has not been declared. This
│ variable can be declared with a variable "resources" {} block.
╵

FAILURE: Build failed with an exception.

I get this failure every 1st build, then I run the same command again (terraformPlan) and it succeeds. Might be something to do with the ordering of when the resources are created vs when my tf file is accessed?

Also in the IDE, the line itself is always declared as an "unresolved" reference.

lamba92 commented 2 years ago

Will have a look

lamba92 commented 2 years ago

could you share a repro project?

blundell commented 2 years ago

Created a simple reproduction project https://github.com/blundell/TerraformGradlePluginPlayground/tree/lambda_not_found_repro/backend however it no longer fails every other time (it succeeds every time). But the IDE still shows it as red/missing:

image

Using the command ./gradlew :backend-terraform:terraformPlan

lamba92 commented 2 years ago

Indeed the TF IJ plugin does not support yet this setup. I will try to support it as soon as I can.