Skip to content

Commit 6518db5

Browse files
committed
fix: added token attribute to terraform_remote state
1 parent cf03518 commit 6518db5

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
kind: Fixed
2+
body: Added missing token field to terraform_remote state
3+
time: 2025-05-06T21:30:35.199691+02:00

internal/state/terraform_cloud.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ func (tcr *TerraformCloudRenderer) Backend() (string, error) {
3030
{{ if .State.Hostname }}
3131
hostname = "{{ .State.Hostname }}"
3232
{{ end }}
33+
{{ if .State.Token }}
34+
token = "{{ .State.Token }}"
35+
{{ end }}
3336
{{ if .State.Workspaces }}
3437
workspaces {
3538
{{ if .State.Workspaces.Name }}
@@ -56,7 +59,7 @@ func (tcr *TerraformCloudRenderer) RemoteState() (string, error) {
5659

5760
template := `
5861
data "terraform_remote_state" "{{ .Key }}" {
59-
backend = "aws"
62+
backend = "remote"
6063
6164
config = {
6265
organization = "{{ .State.Organization }}"

internal/state/terraform_cloud_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ func TestTerraformCloudRendererBackendFull(t *testing.T) {
2727
hostname = "hostname"
2828
2929
30+
token = "token"
31+
32+
3033
workspaces {
3134
3235
@@ -53,7 +56,7 @@ func TestTerraformCloudRendererRemoteStateFull(t *testing.T) {
5356
assert.NoError(t, err)
5457
assert.Equal(t, `
5558
data "terraform_remote_state" "component-1" {
56-
backend = "aws"
59+
backend = "remote"
5760
5861
config = {
5962
organization = "organization"

0 commit comments

Comments
 (0)