Terraform Cloud GCP Service Account key as a variable is not applying our terraform

hi everyone,

We are storing our Google Cloud service account private key in a variable within Terraform Cloud (just copying from the json file to the terraform cloud variable field). We declare that variable as the following within our variables.tf file:

variable "gcp_credentials" {}

Yet, when we plan this within Terraform Cloud we receive the following error:

Warning: Value for undeclared variable

The root module does not declare a variable named "gcp_credentials" but a
value was found in file "/terraform/terraform.tfvars". To use this value, add
a "variable" block to the configuration.

Using a variables file to set an undeclared variable is deprecated and will
become an error in a future release. If you wish to provide certain "global"
settings to all configurations in your organization, use TF_VAR_...
environment variables to set these instead.

Is a large private key like a GCP service account key supposed to be stored or setup differently? Are we missing something with the setup? Is there something that we are missing. Our terraform file is very simple as it’s a proof of concept for terraform cloud.

thank you,

For anyone that stumbles on this post just be sure to be running terraform 0.12, run a terraform validate command, and add the GCP service account json key as a variable. After some fiddling, the plan was run without any issues.

If you find yourself confused on the HCL portion like I was T_T you can use this script as a template: https://github.com/evanniedojadlo/terraform-cloud-gke-example