Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"terraform-plan" fails with an error while using "terraform plan" succeeds #285

Open
AndriiLavrekha opened this issue Jul 25, 2023 · 2 comments
Labels

Comments

@AndriiLavrekha
Copy link

Problem description

"terraform-plan" fails with an error while using "terraform plan" succeeds (see Workflow YAML below).

Terraform version

1.5.1

Backend

Azure blob storage

Workflow YAML

- name: Terraform Plan (non 3rd party) # Works like a charm
        id: plan-non-third-party
        run: terraform plan

      - name: Terraform Plan # fails with the error
        id: plan
        if: (github.event_name == 'pull_request') || ( github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/main')
        uses: dflook/[email protected]
        with:
          path: ${{ inputs.target }}
          label: ${{ inputs.target }}

Workflow log

2023-07-25T10:57:05.1169860Z ##[group]Installing Terraform
2023-07-25T10:57:05.7172014Z gpg: Signature made Tue Apr 19 07:30:27 2022 UTC
2023-07-25T10:57:05.7172696Z gpg:                using RSA key ---------------------
2023-07-25T10:57:05.7204330Z gpg: Good signature from "HashiCorp Security (hashicorp.com/security) <[email protected]>" [ultimate]
2023-07-25T10:57:05.8429868Z terraform_0.12.0_linux_amd64.zip: OK
2023-07-25T10:57:07.7950008Z gpg: Signature made Wed Jun 21 10:32:17 2023 UTC
2023-07-25T10:57:07.7950573Z gpg:                using RSA key ---------------------
2023-07-25T10:57:07.7967975Z gpg: Good signature from "HashiCorp Security (hashicorp.com/security) <[email protected]>" [ultimate]
2023-07-25T10:57:08.0843961Z terraform_1.5.1_linux_amd64.zip: OK
2023-07-25T10:57:08.5504593Z Using the same terraform version that wrote the existing remote state file
2023-07-25T10:57:08.5505159Z Switched to Terraform v1.5.1
2023-07-25T10:57:09.2181916Z Detected azurerm backend
2023-07-25T10:57:09.2182779Z ##[endgroup]
2023-07-25T10:57:09.2188654Z ##[group]Initializing Terraform
2023-07-25T10:57:09.2494002Z 
2023-07-25T10:57:09.2494783Z �[0m�[1mInitializing the backend...�[0m
2023-07-25T10:57:10.2280820Z �[0m�[32m
2023-07-25T10:57:10.2281722Z Successfully configured the backend "azurerm"! Terraform will automatically
2023-07-25T10:57:10.2283260Z use this backend unless the backend configuration changes.�[0m
2023-07-25T10:57:11.2348119Z �[0m�[1mInitializing modules...�[0m
2023-07-25T10:57:11.2353385Z Downloading git::ssh://[email protected]/module-dependency for elastic_dev...
....
2023-07-25T10:57:15.3947094Z �[0m�[1mInitializing provider plugins...�[0m
2023-07-25T10:57:15.3947881Z - Reusing previous version of hashicorp/archive from the dependency lock file
2023-07-25T10:57:15.4574551Z - Reusing previous version of hashicorp/tls from the dependency lock file
2023-07-25T10:57:15.5005163Z - Reusing previous version of elastic/ec from the dependency lock file
2023-07-25T10:57:15.5141448Z - Reusing previous version of hashicorp/azurerm from the dependency lock file
2023-07-25T10:57:15.5551038Z - Reusing previous version of hashicorp/aws from the dependency lock file
2023-07-25T10:57:15.6468282Z - Installing hashicorp/archive v2.4.0...
2023-07-25T10:57:16.1245133Z - Installed hashicorp/archive v2.4.0 (signed by HashiCorp)
2023-07-25T10:57:16.1936631Z - Installing hashicorp/tls v4.0.4...
2023-07-25T10:57:16.6578807Z - Installed hashicorp/tls v4.0.4 (signed by HashiCorp)
2023-07-25T10:57:16.9308095Z - Installing elastic/ec v0.7.0...
2023-07-25T10:57:17.8239281Z - Installed elastic/ec v0.7.0 (signed by a HashiCorp partner, key ID �[0m�[1m---------------------�[0m�[0m)
2023-07-25T10:57:17.8746475Z - Installing hashicorp/azurerm v3.18.0...
2023-07-25T10:57:21.5475472Z - Installed hashicorp/azurerm v3.18.0 (signed by HashiCorp)
2023-07-25T10:57:21.5831713Z - Installing hashicorp/aws v4.51.0...
2023-07-25T10:57:28.7353224Z - Installed hashicorp/aws v4.51.0 (signed by HashiCorp)
2023-07-25T10:57:28.7353799Z 
2023-07-25T10:57:28.7354313Z Partner and community providers are signed by their developers.
2023-07-25T10:57:28.7355507Z If you'd like to know more about provider signing, you can read about it here:
2023-07-25T10:57:28.7356512Z https://www.terraform.io/docs/cli/plugins/signing.html
2023-07-25T10:57:28.7357035Z 
2023-07-25T10:57:28.7357634Z �[0m�[1m�[32mTerraform has been successfully initialized!�[0m�[32m�[0m
2023-07-25T10:57:28.7412332Z ##[endgroup]
.... 
2023-07-25T10:57:54.5985409Z 
2023-07-25T10:57:54.5986282Z Terraform used the selected providers to generate the following execution
2023-07-25T10:57:54.5987397Z plan. Resource actions are indicated with the following symbols:
2023-07-25T10:57:54.5988492Z   ~ update in-place
2023-07-25T10:57:54.5989133Z  <= read (data resources)
2023-07-25T10:57:54.5989520Z 
2023-07-25T10:57:54.5989982Z Terraform planned the following actions, but then encountered a problem:
2023-07-25T10:57:54.5990559Z 
2023-07-25T10:57:54.5993442Z   ~ resource "aws_lambda_function" "lambda-function" {
...
2023-07-25T10:57:54.6003969Z         # (19 unchanged attributes hidden)
2023-07-25T10:57:54.6004401Z 
2023-07-25T10:57:54.6004674Z         # (3 unchanged blocks hidden)
2023-07-25T10:57:54.6005264Z     }
2023-07-25T10:57:54.6005550Z 
2023-07-25T10:57:54.6006373Z   # module.elastic_dev.module.elastic-cloud.data.ec_stack.elastic will be read during apply
2023-07-25T10:57:54.6007463Z   # (depends on a resource or a module with changes pending)
2023-07-25T10:57:54.6008200Z  <= data "ec_stack" "elastic" {
2023-07-25T10:57:54.6008912Z       + accessible          = (known after apply)
2023-07-25T10:57:54.6010062Z       + allowlisted         = (known after apply)
2023-07-25T10:57:54.6010800Z       + apm                 = (known after apply)
2023-07-25T10:57:54.6011505Z       + elasticsearch       = (known after apply)
2023-07-25T10:57:54.6012303Z       + enterprise_search   = (known after apply)
2023-07-25T10:57:54.6013030Z       + id                  = (known after apply)
2023-07-25T10:57:54.6013705Z       + kibana              = (known after apply)
2023-07-25T10:57:54.6014377Z       + lock                = false
2023-07-25T10:57:54.6015065Z       + min_upgradable_from = (known after apply)
2023-07-25T10:57:54.6015909Z       + region              = "us-east-1"
2023-07-25T10:57:54.6016608Z       + upgradable_to       = (known after apply)
2023-07-25T10:57:54.6017336Z       + version             = (known after apply)
2023-07-25T10:57:54.6017988Z       + version_regex       = "8.8.2"
2023-07-25T10:57:54.6018572Z     }
2023-07-25T10:57:54.6018857Z 
2023-07-25T10:57:54.6019501Z Plan: 0 to add, 1 to change, 0 to destroy.
2023-07-25T10:57:54.6200585Z 
2023-07-25T10:57:54.6201144Z Error: Failed to determine whether to use node_roles
2023-07-25T10:57:54.6201480Z 
2023-07-25T10:57:54.6202145Z   with module.elastic_dev.module.elastic-cloud.ec_deployment.elasticsearch_main,
2023-07-25T10:57:54.6203130Z   on /tmp/terraform-data-dir/modules/elastic_dev/modules/elastic-cloud/elastic.tf line 11, in resource "ec_deployment" "elasticsearch_main":
2023-07-25T10:57:54.6203832Z   11: resource "ec_deployment" "elasticsearch_main" {
2023-07-25T10:57:54.6204106Z 
2023-07-25T10:57:54.6204353Z failed to parse Elasticsearch version: Version string empty
@dflook
Copy link
Owner

dflook commented Jul 29, 2023

I'm not familiar with the ec provider. What is ${{ inputs.target }}? The working example appears to be running in a different directory.

@AndriiLavrekha
Copy link
Author

Thanks for the comment!
It is being run under the same directory (inputs.target points to the working directory of terraform project).

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

No branches or pull requests

2 participants