Files
terraform-aws-eks/outputs.tf
Daniel Piddock 11147e9af3 Node groups submodule (#650)
* WIP Move node_groups to a submodule

* Split the old node_groups file up

* Start moving locals

* Simplify IAM creation logic

* depends_on from the TF docs

* Wire in the variables

* Call module from parent

* Allow to customize the role name. As per workers

* aws_auth ConfigMap for node_groups

* Get the managed_node_groups example to plan

* Get the basic example to plan too

* create_eks = false works

"The true and false result expressions must have consistent types. The
given expressions are object and object, respectively."
Well, that's useful. But apparently set(string) and set() are ok. So
everything else is more complicated. Thanks.

* Update Changelog

* Update README

* Wire in node_groups_defaults

* Remove node_groups from workers_defaults_defaults

* Synchronize random and node_group defaults

* Error: "name_prefix" cannot be longer than 32

* Update READMEs again

* Fix double destroy

Was producing index errors when running destroy on an empty state.

* Remove duplicate iam_role in node_group

I think this logic works. Needs some testing with an externally created
role.

* Fix index fail if node group manually deleted

* Keep aws_auth template in top module

Downside: count causes issues as usual: can't use distinct() in the
child module so there's a template render for every node_group even if
only one role is really in use. Hopefully just output noise instead of
technical issue

* Hack to have node_groups depend on aws_auth etc

The AWS Node Groups create or edit the aws-auth ConfigMap so that nodes
can join the cluster. This breaks the kubernetes resource which cannot
do a force create. Remove the race condition with explicit depend.

Can't pull the IAM role out of the node_group any more.

* Pull variables via the random_pet to cut logic

No point having the same logic in two different places

* Pass all ForceNew variables through the pet

* Do a deep merge of NG labels and tags

* Update README.. again

* Additional managed node outputs #644

Add change from @TBeijin from PR #644

* Remove unused local

* Use more for_each

* Remove the change when create_eks = false

* Make documentation less confusing

* node_group version user configurable

* Pass through raw output from aws_eks_node_groups

* Merge workers defaults in the locals

This simplifies the random_pet and aws_eks_node_group logic. Which was
causing much consernation on the PR.

* Fix typo

Co-authored-by: Max Williams <max.williams@deliveryhero.com>
2020-01-09 12:53:08 +01:00

170 lines
5.6 KiB
HCL

output "cluster_id" {
description = "The name/id of the EKS cluster."
value = element(concat(aws_eks_cluster.this.*.id, list("")), 0)
}
output "cluster_arn" {
description = "The Amazon Resource Name (ARN) of the cluster."
value = element(concat(aws_eks_cluster.this.*.arn, list("")), 0)
}
output "cluster_certificate_authority_data" {
description = "Nested attribute containing certificate-authority-data for your cluster. This is the base64 encoded certificate data required to communicate with your cluster."
value = element(concat(aws_eks_cluster.this[*].certificate_authority[0].data, list("")), 0)
}
output "cluster_endpoint" {
description = "The endpoint for your EKS Kubernetes API."
value = element(concat(aws_eks_cluster.this.*.endpoint, list("")), 0)
}
output "cluster_version" {
description = "The Kubernetes server version for the EKS cluster."
value = element(concat(aws_eks_cluster.this[*].version, list("")), 0)
}
output "cluster_security_group_id" {
description = "Security group ID attached to the EKS cluster."
value = local.cluster_security_group_id
}
output "config_map_aws_auth" {
description = "A kubernetes configuration to authenticate to this EKS cluster."
value = kubernetes_config_map.aws_auth.*
}
output "cluster_iam_role_name" {
description = "IAM role name of the EKS cluster."
value = local.cluster_iam_role_name
}
output "cluster_iam_role_arn" {
description = "IAM role ARN of the EKS cluster."
value = local.cluster_iam_role_arn
}
output "cluster_oidc_issuer_url" {
description = "The URL on the EKS cluster OIDC Issuer"
value = flatten(concat(aws_eks_cluster.this[*].identity[*].oidc.0.issuer, [""]))[0]
}
output "cloudwatch_log_group_name" {
description = "Name of cloudwatch log group created"
value = aws_cloudwatch_log_group.this[*].name
}
output "kubeconfig" {
description = "kubectl config file contents for this EKS cluster."
value = concat(data.template_file.kubeconfig[*].rendered, [""])[0]
}
output "kubeconfig_filename" {
description = "The filename of the generated kubectl config."
value = concat(local_file.kubeconfig.*.filename, [""])[0]
}
output "oidc_provider_arn" {
description = "The ARN of the OIDC Provider if `enable_irsa = true`."
value = var.enable_irsa ? aws_iam_openid_connect_provider.oidc_provider[0].arn : null
}
output "workers_asg_arns" {
description = "IDs of the autoscaling groups containing workers."
value = concat(
aws_autoscaling_group.workers.*.arn,
aws_autoscaling_group.workers_launch_template.*.arn,
)
}
output "workers_asg_names" {
description = "Names of the autoscaling groups containing workers."
value = concat(
aws_autoscaling_group.workers.*.id,
aws_autoscaling_group.workers_launch_template.*.id,
)
}
output "workers_user_data" {
description = "User data of worker groups"
value = concat(
data.template_file.userdata.*.rendered,
data.template_file.launch_template_userdata.*.rendered,
)
}
output "workers_default_ami_id" {
description = "ID of the default worker group AMI"
value = data.aws_ami.eks_worker.id
}
output "workers_launch_template_ids" {
description = "IDs of the worker launch templates."
value = aws_launch_template.workers_launch_template.*.id
}
output "workers_launch_template_arns" {
description = "ARNs of the worker launch templates."
value = aws_launch_template.workers_launch_template.*.arn
}
output "workers_launch_template_latest_versions" {
description = "Latest versions of the worker launch templates."
value = aws_launch_template.workers_launch_template.*.latest_version
}
output "worker_security_group_id" {
description = "Security group ID attached to the EKS workers."
value = local.worker_security_group_id
}
output "worker_iam_instance_profile_arns" {
description = "default IAM instance profile ARN for EKS worker groups"
value = concat(
aws_iam_instance_profile.workers.*.arn,
aws_iam_instance_profile.workers_launch_template.*.arn
)
}
output "worker_iam_instance_profile_names" {
description = "default IAM instance profile name for EKS worker groups"
value = concat(
aws_iam_instance_profile.workers.*.name,
aws_iam_instance_profile.workers_launch_template.*.name
)
}
output "worker_iam_role_name" {
description = "default IAM role name for EKS worker groups"
value = coalescelist(
aws_iam_role.workers.*.name,
data.aws_iam_instance_profile.custom_worker_group_iam_instance_profile.*.role_name,
data.aws_iam_instance_profile.custom_worker_group_launch_template_iam_instance_profile.*.role_name,
[""]
)[0]
}
output "worker_iam_role_arn" {
description = "default IAM role ARN for EKS worker groups"
value = coalescelist(
aws_iam_role.workers.*.arn,
data.aws_iam_instance_profile.custom_worker_group_iam_instance_profile.*.role_arn,
data.aws_iam_instance_profile.custom_worker_group_launch_template_iam_instance_profile.*.role_arn,
[""]
)[0]
}
output "worker_autoscaling_policy_name" {
description = "Name of the worker autoscaling IAM policy if `manage_worker_autoscaling_policy = true`"
value = concat(aws_iam_policy.worker_autoscaling[*].name, [""])[0]
}
output "worker_autoscaling_policy_arn" {
description = "ARN of the worker autoscaling IAM policy if `manage_worker_autoscaling_policy = true`"
value = concat(aws_iam_policy.worker_autoscaling[*].arn, [""])[0]
}
output "node_groups" {
description = "Outputs from EKS node groups. Map of maps, keyed by var.node_groups keys"
value = module.node_groups.node_groups
}