From ba47f9dec5ed41e464a86bdb41ac5f902ad5e416 Mon Sep 17 00:00:00 2001 From: Matt Bush Date: Thu, 30 May 2024 17:03:31 -0700 Subject: [PATCH] switch to terraform id extractor for cluster references So that the refs don't resolve until after the cluster exists Signed-off-by: Matt Bush --- config/eks/config.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/config/eks/config.go b/config/eks/config.go index 638a4bfcc8..707e1bcc14 100644 --- a/config/eks/config.go +++ b/config/eks/config.go @@ -113,6 +113,9 @@ func Configure(p *config.Provider) { r.References = config.References{ "cluster_name": { TerraformName: "aws_eks_cluster", + // Use the terraform id instead of the external name because the external name is set before the cluster + // has been created. + Extractor: common.PathTerraformIDExtractor, }, // Principal Arn can refer to either the ARN of an IAM user or an IAM role, with a strong best-practice // recommendation to always use roles. However, the eks Access Policy resource won't do anything unless @@ -120,7 +123,7 @@ func Configure(p *config.Provider) { // the principal arn from the Access Entry, we provide an easy means of ordered creation. "principal_arn": { TerraformName: "aws_eks_access_entry", - Extractor: `github.com/crossplane/upjet/pkg/resource.ExtractParamPath("principal_arn",false)`, + Extractor: `github.com/crossplane/upjet/pkg/resource.ExtractParamPath("principal_arn",true)`, }, } }) @@ -128,6 +131,9 @@ func Configure(p *config.Provider) { r.References = config.References{ "cluster_name": { TerraformName: "aws_eks_cluster", + // Use the terraform id instead of the external name because the external name is set before the cluster + // has been created. + Extractor: common.PathTerraformIDExtractor, }, "principal_arn": { TerraformName: "aws_iam_role",