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

Add support for terraform_remote_state #480

Closed
leg100 opened this issue Jun 26, 2023 · 2 comments · Fixed by #550
Closed

Add support for terraform_remote_state #480

leg100 opened this issue Jun 26, 2023 · 2 comments · Fixed by #550

Comments

@leg100
Copy link
Owner

leg100 commented Jun 26, 2023

A user cannot use terraform_remote_state to reference the state of OTF workspaces.

Currently, OTF issues the terraform process with a "run token", which only has permissions to access the OTF module registry, for the retrieval of child modules during a terraform init. it does not have permissions to access any other endpoints on OTF, including the state endpoints which would allow terraform_remote_state to succeed.

TFC by default does not share state with other workspaces but does provide the option to open up access workspace by workspace, or to the entire organization:

image

This is perhaps something that could be adopted by OTF.

@Spritekin
Copy link
Contributor

Spritekin commented Jun 27, 2023

Interesting. But maybe you can test this, I know its not the same but maybe it works:

a. issue a full access token. The same token a user would use to access the OTF API.

b. Use the token like this:

data "terraform_remote_state" "oss_prod" {
  backend = "remote"

  config = {
    hostname = "otf.oss.ossy.dev"
    token = var.token
    organization = "Spritekin"
    workspaces = {
      name = "my-workspace"
    }
  }
}

Just as a worksround while you solve this problem.

@take-five
Copy link

It would be nice if OTF supported it out of the box. We're currently looking if OTF can be used within our organization - we use state sharing quite a lot and this is a blocker

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