I’m Unable to create aws k8s secret using Terraform Cloud with OIDC authentication, where as i’m able to create it using normal aws access_key and secret_key authentication and just to check if the setup is proper i tried creating s3 bucket and ec2 instance using OIDC authentication which worked fine.
Please let me know if there is any other variable to be added to get kubectl authentication apart from TFC_AWS_PROVIDER_AUTH and TFC_AWS_RUN_ROLE_ARN in TFC.
snippet is below:
terraform {
required_providers {
aws = {
source = “hashicorp/aws”
version = “>=4.66.0”
}
}
cloud {
organization = “abc123”
workspaces {
name = “test123”
}
}
}
provider “aws” {
region = “us-west-2”
}
provider “kubernetes” {
host = data.aws_eks_cluster.cluster.endpoint
cluster_ca_certificate = base64decode(data.aws_eks_cluster.cluster.certificate_authority.0.data)
token = data.aws_eks_cluster_auth.cluster.token
}
resource “kubernetes_secret” “example” {
metadata {
name = “terraform-secret”
namespace = “default”
}
}