gridscale / terraform-examples

Template files to help you get started with Terraform and gridscale
https://gridscale.io
MIT License
4 stars 2 forks source link

Unable to use Multi Projects with API Key token created on different Project. #7

Closed tmallikarjuna closed 3 years ago

tmallikarjuna commented 3 years ago

Even Though I am using a different project token to create resources on Gridscale, terraform is creating resources on default project only.

Please do fix this problem.

Terraform version: 0.13.4 GridScale Terraform Provider version: v1.7.4

nvthongswansea commented 3 years ago

Thanks for reporting the issue. We will take a look at it as soon as possible.

nvthongswansea commented 3 years ago

@tmallikarjuna According to gridscale multi-project, you will need to source the .envrc file (or use a tool called "direnv" to easily switch between environment variables) before applying. The command to source the .envrc is source .envrc.

nvthongswansea commented 3 years ago

@tmallikarjuna btw, I will update the README file to highlight "source the .envrc file" part.

nvthongswansea commented 3 years ago

Another way to deal with the multiple project is to define a block as following in each .tf file:

provider "gridscale" {
  uuid = "uuid" ## This can be discarded; if you already set it in an environment variable, and the projects use the same user UUID
  token = "project-a-token"
}

For more info: https://registry.terraform.io/providers/gridscale/gridscale/latest/docs

tmallikarjuna commented 3 years ago

Hi Tom,

Thanks for the information. I was sourcing the .envrc file and the reason I don't know why it was overriding my default project's API key and maybe due to a global sourcing file was interrupting. Anyways, thanks for the info and the update of the guide.

Best regards, Tejesh