terraform-provider-kubernetes
terraform-provider-kubernetes copied to clipboard
Failed to get RESTMapper config when working with modules but working fine when working with resources.
Terraform Version, Provider Version and Kubernetes Version
Terraform version: v.1.10.3
Kubernetes provider version: v2.6.1 (ive also tried the newest version 2.35.1, same error)
Kubernetes version: v1.32.1
Affected Resource(s)
kubernetes_manifest (as a module)
Terraform Configuration Files
this version works with resources
{
"terraform": {
"required_providers": {
"kubernetes": {
"source": "hashicorp/kubernetes",
"version": "~>2.6.1"
}
},
"backend": {
"s3": {
"bucket": "apughc9-terraform-access",
"key": "terraform.tfstate",
"region": "us-east-1",
"endpoints": {
"s3": "https://objectstorage.xxx.com"
},
"skip_credentials_validation": true,
"skip_requesting_account_id": true,
"skip_metadata_api_check": true,
"skip_region_validation": true,
"use_path_style": true,
"skip_s3_checksum": true,
"access_key": "xxx",
"secret_key": "xxx"
}
}
},
"provider": {
"kubernetes": [
{
"config_path": "kubeconfig.yaml"
}
]
}
}
resource "kubernetes_manifest" "bucket" {
manifest = {
apiVersion = "object.gdc.goog/v1"
kind = "Bucket"
metadata = {
name = var.bucket_name
namespace = var.namespace_name
}
spec = {
description = var.description
storageClass = "Standard"
bucketPolicy = {
lockingPolicy = {
defaultObjectRetentionDays = var.retention_day_count
}
}
}
}
}
this doesnt:
{
"terraform": {
"required_providers": {
"kubernetes": {
"source": "hashicorp/kubernetes",
"version": "~>2.6.1"
}
},
"backend": {
"s3": {
"bucket": "apughc9-terraform-access",
"key": "terraform.tfstate",
"region": "us-east-1",
"endpoints": {
"s3": "https://objectstorage.xxxcom"
},
"skip_credentials_validation": true,
"skip_requesting_account_id": true,
"skip_metadata_api_check": true,
"skip_region_validation": true,
"use_path_style": true,
"skip_s3_checksum": true,
"access_key": "xxx",
"secret_key": "xxx"
}
}
},
"provider": {
"kubernetes": [
{
"alias": "sandbox",
"config_path": "kubeconfig.yaml"
}
]
}
}
{
"module": {
"First_Bucket": [
{
"bucket_name": "${var.bucket_name}",
"description": "${var.description}",
"namespace_name": "${var.namespace_name}",
"providers": {
"kubernetes": "kubernetes.sandbox"
},
"retention_day_count": "${var.retention_day_count}",
"source": "./_modules/gdc/csi/bucket"
}
]
}
}
Debug Output
not working: https://gist.github.com/mvn187/34cd0072e2be90c093f73709b4ecc773
working: https://gist.github.com/mvn187/22e43adda83bed8146972d28e615ac11
Panic Output
None
Steps to Reproduce
With the Resource: Terraform init Terraform plan all good
With the module: Terraform init Terraform plan -> plan runs successful but ends with an error
Expected Behavior
Plan should run without issues
Actual Behavior
Plan Errors after ending
Important Factoids
Im working in Google Distributed Cloud, were using custom resources that are calling apis to create something in the namespace. These CRDs do already exist. Like described, it only results in an error if im using a Module with an alias instead of using the resource directly
References
None
Community Note
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment