Skip to content

Commit 487f8aa

Browse files
committed
use ca
1 parent ab6d09c commit 487f8aa

File tree

3 files changed

+24
-3
lines changed

3 files changed

+24
-3
lines changed

.github/workflows/crossplane-release.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ jobs:
123123
-var-file=${{ inputs.environment }}.tfvars \
124124
-var="commit_hash=${{ github.sha }}" \
125125
-var="config_path=${{ github.workspace }}/kubeconfig.yaml" \
126+
-var="cluster_ca_certificate=${{ secrets.EKS_PRD_CA_DATA }}" \
127+
-var="cluster_endpoint=${{ secrets.EKS_PRD_HOST }}" \
126128
-var="service_name=${{ inputs.service_name }}"
127129
env:
128130
TF_WORKSPACE: ${{ inputs.environment }}

crossplane/variables.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,13 @@ variable "config_path" {
2222
description = "path to the config file"
2323
type = string
2424
}
25+
26+
variable "cluster_endpoint" {
27+
description = "endpoint of the eks cluster"
28+
type = string
29+
}
30+
31+
variable "cluster_ca_certificate" {
32+
description = "certificate of the eks cluster"
33+
type = string
34+
}

crossplane/versions.tf

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,16 @@ terraform {
2424
}
2525

2626
provider "kubectl" {
27-
config_path = var.config_path
28-
load_config_file = true
29-
apply_retry_count = 15
27+
apply_retry_count = 5
28+
host = var.cluster_endpoint
29+
cluster_ca_certificate = base64decode(var.cluster_ca_certificate)
30+
load_config_file = false
31+
32+
exec {
33+
api_version = "client.authentication.k8s.io/v1beta1"
34+
command = "aws"
35+
# This requires the awscli to be installed locally where Terraform is executed
36+
args = ["eks", "get-token", "--cluster-name", var.cluster_name]
37+
}
3038
}
39+

0 commit comments

Comments
 (0)