Skip to content

Commit aafc27b

Browse files
committed
(fix) Circular dependency on kubeconfig for Coder installations
1. Updated providers.tf in all environments: - Changed Kubernetes provider from config_path to config_raw to read kubeconfig directly from remote state - Changed Helm provider from config_path to config_raw - Removed the local_file resource that was creating the circular dependency 2. Updated main.tf in all environments: - Added skip_requesting_account_id = true to the remote state data source configuration to fix AWS authentication errors with Scaleway S3 These changes will: - Fix the circular dependency that was preventing Terraform initialization - Allow the GitHub Actions workflow to complete successfully - Maintain compatibility with local scripts that use saved kubeconfig files - Work seamlessly with both CI/CD and local development workflows.
1 parent 364ff4d commit aafc27b

File tree

6 files changed

+15
-24
lines changed

6 files changed

+15
-24
lines changed

environments/dev/coder/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ data "terraform_remote_state" "infra" {
1515
skip_credentials_validation = true
1616
skip_metadata_api_check = true
1717
skip_region_validation = true
18+
skip_requesting_account_id = true
1819
}
1920
}
2021

environments/dev/coder/providers.tf

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,13 @@ terraform {
2323

2424
# Configure Kubernetes provider using kubeconfig from infrastructure
2525
provider "kubernetes" {
26-
config_path = "${path.module}/kubeconfig"
26+
# Use the kubeconfig content directly from remote state
27+
config_raw = data.terraform_remote_state.infra.outputs.kubeconfig
2728
}
2829

2930
provider "helm" {
3031
kubernetes {
31-
config_path = "${path.module}/kubeconfig"
32+
# Use the kubeconfig content directly from remote state
33+
config_raw = data.terraform_remote_state.infra.outputs.kubeconfig
3234
}
33-
}
34-
35-
# Write kubeconfig to file for providers
36-
resource "local_file" "kubeconfig" {
37-
content = data.terraform_remote_state.infra.outputs.kubeconfig
38-
filename = "${path.module}/kubeconfig"
3935
}

environments/prod/coder/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ data "terraform_remote_state" "infra" {
1515
skip_credentials_validation = true
1616
skip_metadata_api_check = true
1717
skip_region_validation = true
18+
skip_requesting_account_id = true
1819
}
1920
}
2021

environments/prod/coder/providers.tf

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,13 @@ terraform {
2323

2424
# Configure Kubernetes provider using kubeconfig from infrastructure
2525
provider "kubernetes" {
26-
config_path = "${path.module}/kubeconfig"
26+
# Use the kubeconfig content directly from remote state
27+
config_raw = data.terraform_remote_state.infra.outputs.kubeconfig
2728
}
2829

2930
provider "helm" {
3031
kubernetes {
31-
config_path = "${path.module}/kubeconfig"
32+
# Use the kubeconfig content directly from remote state
33+
config_raw = data.terraform_remote_state.infra.outputs.kubeconfig
3234
}
33-
}
34-
35-
# Write kubeconfig to file for providers
36-
resource "local_file" "kubeconfig" {
37-
content = data.terraform_remote_state.infra.outputs.kubeconfig
38-
filename = "${path.module}/kubeconfig"
3935
}

environments/staging/coder/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ data "terraform_remote_state" "infra" {
1515
skip_credentials_validation = true
1616
skip_metadata_api_check = true
1717
skip_region_validation = true
18+
skip_requesting_account_id = true
1819
}
1920
}
2021

environments/staging/coder/providers.tf

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,13 @@ terraform {
2323

2424
# Configure Kubernetes provider using kubeconfig from infrastructure
2525
provider "kubernetes" {
26-
config_path = "${path.module}/kubeconfig"
26+
# Use the kubeconfig content directly from remote state
27+
config_raw = data.terraform_remote_state.infra.outputs.kubeconfig
2728
}
2829

2930
provider "helm" {
3031
kubernetes {
31-
config_path = "${path.module}/kubeconfig"
32+
# Use the kubeconfig content directly from remote state
33+
config_raw = data.terraform_remote_state.infra.outputs.kubeconfig
3234
}
33-
}
34-
35-
# Write kubeconfig to file for providers
36-
resource "local_file" "kubeconfig" {
37-
content = data.terraform_remote_state.infra.outputs.kubeconfig
38-
filename = "${path.module}/kubeconfig"
3935
}

0 commit comments

Comments
 (0)