Skip to content
This repository has been archived by the owner on Dec 26, 2023. It is now read-only.

Bug: Issue creating variable sets through API / tfe provider #588

Closed
adamlc opened this issue Sep 5, 2023 · 1 comment · Fixed by #589 or #587
Closed

Bug: Issue creating variable sets through API / tfe provider #588

adamlc opened this issue Sep 5, 2023 · 1 comment · Fixed by #589 or #587

Comments

@adamlc
Copy link

adamlc commented Sep 5, 2023

Thank you for all your work on variable sets, its really helped with our setup workflow significantly.

We're now running 38 workspaces migrated from TF Cloud!

Anyway, I did have an issue when creating variable sets through the TFE terraform provider on OTF 0.1.9.

terraform {
  required_providers {
    tfe = {
      version = "~> 0.48.0"
    }
  }
}

provider "tfe" {
  hostname = "..."
  organization = "..."
}

resource "tfe_variable_set" "test" {
  name          = "Test Varset"
  description   = "Some description."
}

resource "tfe_variable" "test-a" {
  key             = "seperate_variable"
  value           = "my_value_name"
  category        = "terraform"
  description     = "a useful description"
  variable_set_id = tfe_variable_set.test.id
}

resource "tfe_variable" "test-b" {
  key             = "another_variable"
  value           = "my_value_name"
  category        = "env"
  description     = "an environment variable"
  variable_set_id = tfe_variable_set.test.id
}

Producing the following plan:

terraform plan -out="plan.tfplan"

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # tfe_variable.test-a will be created
  + resource "tfe_variable" "test-a" {
      + category        = "terraform"
      + description     = "a useful description"
      + hcl             = false
      + id              = (known after apply)
      + key             = "seperate_variable"
      + readable_value  = "my_value_name"
      + sensitive       = false
      + value           = (sensitive value)
      + variable_set_id = (known after apply)
    }

  # tfe_variable.test-b will be created
  + resource "tfe_variable" "test-b" {
      + category        = "env"
      + description     = "an environment variable"
      + hcl             = false
      + id              = (known after apply)
      + key             = "another_variable"
      + readable_value  = "my_value_name"
      + sensitive       = false
      + value           = (sensitive value)
      + variable_set_id = (known after apply)
    }

  # tfe_variable_set.test will be created
  + resource "tfe_variable_set" "test" {
      + description   = "Some description."
      + global        = false
      + id            = (known after apply)
      + name          = "Test Varset"
      + organization  = (known after apply)
      + workspace_ids = (known after apply)
    }

Plan: 3 to add, 0 to change, 0 to destroy.

But when I apply the plan the variable set itself gets created. But the variables hang eventually failing with a interface pointer error.

terraform apply "plan.tfplan"
tfe_variable_set.test: Creating...
tfe_variable_set.test: Creation complete after 1s [id=varset-iQaii6nhzbOCoMKW]
tfe_variable.test-a: Creating...
tfe_variable.test-b: Creating...
tfe_variable.test-b: Still creating... [10s elapsed]
tfe_variable.test-a: Still creating... [10s elapsed]
tfe_variable.test-b: Still creating... [20s elapsed]
tfe_variable.test-a: Still creating... [20s elapsed]
tfe_variable.test-b: Still creating... [30s elapsed]
tfe_variable.test-a: Still creating... [30s elapsed]
tfe_variable.test-b: Still creating... [40s elapsed]
tfe_variable.test-a: Still creating... [40s elapsed]
tfe_variable.test-b: Still creating... [50s elapsed]
tfe_variable.test-a: Still creating... [50s elapsed]
tfe_variable.test-b: Still creating... [1m0s elapsed]
tfe_variable.test-a: Still creating... [1m0s elapsed]
tfe_variable.test-b: Still creating... [1m10s elapsed]
tfe_variable.test-a: Still creating... [1m10s elapsed]
tfe_variable.test-b: Still creating... [1m20s elapsed]
tfe_variable.test-a: Still creating... [1m20s elapsed]
tfe_variable.test-b: Still creating... [1m30s elapsed]
tfe_variable.test-a: Still creating... [1m30s elapsed]
tfe_variable.test-b: Still creating... [1m40s elapsed]
tfe_variable.test-a: Still creating... [1m40s elapsed]
tfe_variable.test-b: Still creating... [1m50s elapsed]
tfe_variable.test-a: Still creating... [1m50s elapsed]
tfe_variable.test-b: Still creating... [2m0s elapsed]
tfe_variable.test-a: Still creating... [2m0s elapsed]
tfe_variable.test-b: Still creating... [2m10s elapsed]
tfe_variable.test-a: Still creating... [2m10s elapsed]
tfe_variable.test-b: Still creating... [2m20s elapsed]
tfe_variable.test-a: Still creating... [2m20s elapsed]
tfe_variable.test-b: Still creating... [2m30s elapsed]
tfe_variable.test-a: Still creating... [2m30s elapsed]
tfe_variable.test-b: Still creating... [2m40s elapsed]
tfe_variable.test-a: Still creating... [2m40s elapsed]
tfe_variable.test-b: Still creating... [2m50s elapsed]
tfe_variable.test-a: Still creating... [2m50s elapsed]
tfe_variable.test-b: Still creating... [3m0s elapsed]
tfe_variable.test-a: Still creating... [3m0s elapsed]
tfe_variable.test-b: Still creating... [3m10s elapsed]
tfe_variable.test-a: Still creating... [3m10s elapsed]
tfe_variable.test-b: Still creating... [3m20s elapsed]
tfe_variable.test-a: Still creating... [3m20s elapsed]
tfe_variable.test-b: Still creating... [3m30s elapsed]
tfe_variable.test-a: Still creating... [3m30s elapsed]
tfe_variable.test-b: Still creating... [3m40s elapsed]
tfe_variable.test-a: Still creating... [3m40s elapsed]
tfe_variable.test-b: Still creating... [3m50s elapsed]
tfe_variable.test-a: Still creating... [3m50s elapsed]
tfe_variable.test-b: Still creating... [4m0s elapsed]
tfe_variable.test-a: Still creating... [4m0s elapsed]
tfe_variable.test-b: Still creating... [4m10s elapsed]
tfe_variable.test-a: Still creating... [4m10s elapsed]
tfe_variable.test-b: Still creating... [4m20s elapsed]
tfe_variable.test-a: Still creating... [4m20s elapsed]
tfe_variable.test-b: Still creating... [4m30s elapsed]
tfe_variable.test-a: Still creating... [4m30s elapsed]
tfe_variable.test-b: Still creating... [4m40s elapsed]
tfe_variable.test-a: Still creating... [4m40s elapsed]
tfe_variable.test-b: Still creating... [4m50s elapsed]
tfe_variable.test-a: Still creating... [4m50s elapsed]
tfe_variable.test-b: Still creating... [5m0s elapsed]
tfe_variable.test-a: Still creating... [5m0s elapsed]
tfe_variable.test-b: Still creating... [5m10s elapsed]
tfe_variable.test-a: Still creating... [5m10s elapsed]
tfe_variable.test-b: Still creating... [5m20s elapsed]
tfe_variable.test-a: Still creating... [5m20s elapsed]
tfe_variable.test-b: Still creating... [5m30s elapsed]
tfe_variable.test-a: Still creating... [5m30s elapsed]
tfe_variable.test-b: Still creating... [5m40s elapsed]
tfe_variable.test-a: Still creating... [5m40s elapsed]
tfe_variable.test-b: Still creating... [5m50s elapsed]
tfe_variable.test-a: Still creating... [5m50s elapsed]
tfe_variable.test-b: Still creating... [6m0s elapsed]
tfe_variable.test-a: Still creating... [6m0s elapsed]
tfe_variable.test-b: Still creating... [6m10s elapsed]
tfe_variable.test-a: Still creating... [6m10s elapsed]
tfe_variable.test-b: Still creating... [6m20s elapsed]
╷
│ Error: Error creating variable
│
│   with tfe_variable.test-a,
│   on main.tf line 21, in resource "tfe_variable" "test-a":
│   21: resource "tfe_variable" "test-a" {
│
│ Couldn't create terraform variable seperate_variable: Internal Server Error
│
│ schema: interface must be a pointer to struct
╵
╷
│ Error: Error creating variable
│
│   with tfe_variable.test-b,
│   on main.tf line 29, in resource "tfe_variable" "test-b":
│   29: resource "tfe_variable" "test-b" {
│
│ Couldn't create env variable another_variable: Internal Server Error
│
│ schema: interface must be a pointer to struct

Thanks!

@leg100
Copy link
Owner

leg100 commented Sep 5, 2023

Hello. Looks like the API endpoints for variable set variables were never implemented properly, and certainly not tested. I'll work on a fix shortly.

leg100 added a commit that referenced this issue Sep 6, 2023
leg100 pushed a commit that referenced this issue Sep 6, 2023
🤖 I have created a release *beep* *boop*
---


## [0.1.10](v0.1.9...v0.1.10)
(2023-09-06)


### Bug Fixes

* **integration:** ensure text box is visible before focusing
([8d279ae](8d279ae))
* set module status ([#586](#586))
([8141c6e](8141c6e))
* **ui:** remove undefined css classes
([daf6096](daf6096))
* **ui:** wrong heading for edit variable set variable page
([cc6f282](cc6f282))
* variable set variables API
([#589](#589))
([8e29da1](8e29da1)),
closes [#588](#588)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants