Execute eksctl from terraform
cluster_name and profile are terraform variables
resource "null_resource" "oidc_provider" {
triggers = {
cluster_name = var.cluster_name
}
provisioner "local-exec" {
command = <<EOF
AWS_PROFILE=${var.profile} eksctl utils associate-iam-oidc-provider --cluster ${var.cluster_name} --approve
EOF
}
}
Check result with command
aws iam list-open-id-connect-providers | jq ".OpenIDConnectProviderList[].Arn"