Skip to content

Commit

Permalink
switch to terraform id extractor for cluster references
Browse files Browse the repository at this point in the history
So that the refs don't resolve until after the cluster exists

Signed-off-by: Matt Bush <[email protected]>
  • Loading branch information
mbbush committed Jun 5, 2024
1 parent 01e7281 commit ba47f9d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion config/eks/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,21 +113,27 @@ 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
// the principal arn matches a principal with an eks Access Entry defined on the same cluster. By retrieving
// 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)`,
},
}
})
p.AddResourceConfigurator("aws_eks_access_entry", func(r *config.Resource) {
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",
Expand Down

0 comments on commit ba47f9d

Please sign in to comment.