Skip to content

Commit e2a39c0

Browse files
authored
fix: Forces cluster outputs to wait until access entries are complete (#3000)
1 parent 07be37d commit e2a39c0

File tree

3 files changed

+20
-8
lines changed

3 files changed

+20
-8
lines changed

examples/karpenter/README.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,6 @@ kubectl delete node -l karpenter.sh/provisioner-name=default
4141
2. Remove the resources created by Terraform
4242

4343
```bash
44-
# Necessary to avoid removing Terraform's permissions too soon before its finished
45-
# cleaning up the resources it deployed inside the cluster
46-
terraform state rm 'module.eks.aws_eks_access_entry.this["cluster_creator"]' || true
47-
terraform state rm 'module.eks.aws_eks_access_policy_association.this["cluster_creator_admin"]' || true
48-
4944
terraform destroy
5045
```
5146

examples/outposts/README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@ $ terraform apply
3737
Note that this example may create resources which cost money. Run `terraform destroy` when you don't need these resources.
3838

3939
```bash
40-
# Necessary to avoid removing Terraform's permissions too soon before its finished
41-
# cleaning up the resources it deployed inside the clsuter
42-
terraform state rm 'module.eks.aws_eks_access_entry.this["cluster_creator_admin"]' || true
4340
terraform destroy
4441
```
4542

outputs.tf

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,31 @@
55
output "cluster_arn" {
66
description = "The Amazon Resource Name (ARN) of the cluster"
77
value = try(aws_eks_cluster.this[0].arn, null)
8+
9+
depends_on = [
10+
aws_eks_access_entry.this,
11+
aws_eks_access_policy_association.this,
12+
]
813
}
914

1015
output "cluster_certificate_authority_data" {
1116
description = "Base64 encoded certificate data required to communicate with the cluster"
1217
value = try(aws_eks_cluster.this[0].certificate_authority[0].data, null)
18+
19+
depends_on = [
20+
aws_eks_access_entry.this,
21+
aws_eks_access_policy_association.this,
22+
]
1323
}
1424

1525
output "cluster_endpoint" {
1626
description = "Endpoint for your Kubernetes API server"
1727
value = try(aws_eks_cluster.this[0].endpoint, null)
28+
29+
depends_on = [
30+
aws_eks_access_entry.this,
31+
aws_eks_access_policy_association.this,
32+
]
1833
}
1934

2035
output "cluster_id" {
@@ -25,6 +40,11 @@ output "cluster_id" {
2540
output "cluster_name" {
2641
description = "The name of the EKS cluster"
2742
value = try(aws_eks_cluster.this[0].name, "")
43+
44+
depends_on = [
45+
aws_eks_access_entry.this,
46+
aws_eks_access_policy_association.this,
47+
]
2848
}
2949

3050
output "cluster_oidc_issuer_url" {

0 commit comments

Comments
 (0)