feat: Replace the local-exec script with a http datasource for waiting cluster (#1339)

NOTES: Using the [terraform-aws-modules/http](https://registry.terraform.io/providers/terraform-aws-modules/http/latest) provider is a more platform agnostic way to wait for the cluster availability than using a local-exec. With this change we're able to provision EKS clusters and manage the `aws_auth` configmap while still using the `hashicorp/tfc-agent` docker image.
This commit is contained in:
Thierno IB. BARRY
2021-05-17 10:11:36 +02:00
committed by GitHub
parent 781f673295
commit e3bf48bba2
7 changed files with 35 additions and 64 deletions

View File

@@ -1,9 +1,10 @@
output "cluster_id" {
description = "The name/id of the EKS cluster. Will block on cluster creation until the cluster is really ready"
description = "The name/id of the EKS cluster. Will block on cluster creation until the cluster is really ready."
value = element(concat(aws_eks_cluster.this.*.id, [""]), 0)
# So that calling plans wait for the cluster to be available before attempting
# to use it. They will not need to duplicate this null_resource
depends_on = [null_resource.wait_for_cluster]
# So that calling plans wait for the cluster to be available before attempting to use it.
# There is no need to duplicate this datasource
depends_on = [data.http.wait_for_cluster]
}
output "cluster_arn" {
@@ -67,13 +68,21 @@ output "cloudwatch_log_group_arn" {
}
output "kubeconfig" {
description = "kubectl config file contents for this EKS cluster."
description = "kubectl config file contents for this EKS cluster. Will block on cluster creation until the cluster is really ready."
value = local.kubeconfig
# So that calling plans wait for the cluster to be available before attempting to use it.
# There is no need to duplicate this datasource
depends_on = [data.http.wait_for_cluster]
}
output "kubeconfig_filename" {
description = "The filename of the generated kubectl config."
description = "The filename of the generated kubectl config. Will block on cluster creation until the cluster is really ready."
value = concat(local_file.kubeconfig.*.filename, [""])[0]
# So that calling plans wait for the cluster to be available before attempting to use it.
# There is no need to duplicate this datasource
depends_on = [data.http.wait_for_cluster]
}
output "oidc_provider_arn" {