hashicorp / tfc-workflows-github

HCP Terraform starter workflows and github actions to automate Terraform Cloud CI/CD pipelines.
Mozilla Public License 2.0
124 stars 20 forks source link

error uploading configuration version to Terraform Cloud: resource not found #15

Open arnoldokoth opened 11 months ago

arnoldokoth commented 11 months ago

Running into this error and not quite sure what's causing it:

/usr/bin/docker run --name hashicorptfciv102_e9c9b6 --label c9a4a5 --workdir /github/workspace --rm -e "TF_CLOUD_ORGANIZATION" -e "TF_API_TOKEN" -e "TF_WORKSPACE" -e "CONFIG_DIRECTORY" -e "INPUT_WORKSPACE" -e "INPUT_DIRECTORY" -e "INPUT_SPECULATIVE" -e "INPUT_HOSTNAME" -e "INPUT_TOKEN" -e "INPUT_ORGANIZATION" -e "HOME" -e "GITHUB_JOB" -e "GITHUB_REF" -e "GITHUB_SHA" -e "GITHUB_REPOSITORY" -e "GITHUB_REPOSITORY_OWNER" -e "GITHUB_REPOSITORY_OWNER_ID" -e "GITHUB_RUN_ID" -e "GITHUB_RUN_NUMBER" -e "GITHUB_RETENTION_DAYS" -e "GITHUB_RUN_ATTEMPT" -e "GITHUB_REPOSITORY_ID" -e "GITHUB_ACTOR_ID" -e "GITHUB_ACTOR" -e "GITHUB_TRIGGERING_ACTOR" -e "GITHUB_WORKFLOW" -e "GITHUB_HEAD_REF" -e "GITHUB_BASE_REF" -e "GITHUB_EVENT_NAME" -e "GITHUB_SERVER_URL" -e "GITHUB_API_URL" -e "GITHUB_GRAPHQL_URL" -e "GITHUB_REF_NAME" -e "GITHUB_REF_PROTECTED" -e "GITHUB_REF_TYPE" -e "GITHUB_WORKFLOW_REF" -e "GITHUB_WORKFLOW_SHA" -e "GITHUB_WORKSPACE" -e "GITHUB_ACTION" -e "GITHUB_EVENT_PATH" -e "GITHUB_ACTION_REPOSITORY" -e "GITH...
{
  "status": "Error"
error uploading configuration version to Terraform Cloud: resource not found
}

Did I misconfigure something?

jeff-knurek commented 11 months ago

I've run into the same problem.

Did some digging around and the error message comes from the hashicorp/tfci image, and running the same commands in that docker image gets the same error. I didn't get any farther with the debug logs though.

srlynch1 commented 11 months ago

Can you confirm you have specified a pre-existing workspace and and token

jeff-knurek commented 11 months ago

yes, I have confirmed that the token is set by running:

tfci run show -run run-tKXXXX

and it was successful, and the workspace exists. I have tried with the workspace name and the id, both with the same error.

andyjhull commented 11 months ago

Resolution for me was to use the correct type of token. It needs to be a Team token rather than an Organization token.

jeff-knurek commented 11 months ago

Resolution for me was to use the correct type of token. It needs to be a Team token rather than an Organization token.

yup, that worked 🎉 🤯

I guess this issue should be reframed to be a feature request for better documentation.

jonilsonds9 commented 8 months ago

Any news guys? Because even using the team token I still get this error

gustavoplensack commented 8 months ago

Any news guys? Because even using the team token I still get this error

Hi friend @jonilsonds9, not sure from where you are starting at your config, but using this suggestion from https://discuss.hashicorp.com/t/terraform-cloud-workspaces-not-able-to-use-cli-plan-apply-error-updating-workspace-resource-not-found/52502/3 helped me.

TL;DR: just added a dummy tag totags in my workspaces config.

    workspaces {
      tags = ["some-tag"]
    }
jonhoo commented 6 months ago

In my case, I had to enable the "Manage all workspaces" setting for the team as well (you can probably also do it just for a specific workspace if that's better for your setup).

trsmarc commented 5 months ago

Resolution for me was to use the correct type of token. It needs to be a Team token rather than an Organization token.

Thank you for the resolution, This should be mentioned in the following source