diff --git a/README.md b/README.md index 01c442c..fb3040c 100644 --- a/README.md +++ b/README.md @@ -193,20 +193,18 @@ Available targets: |------|---------| | [terraform](#requirement\_terraform) | >= 0.13 | | [aws](#requirement\_aws) | >= 2.0 | -| [template](#requirement\_template) | >= 2.0 | ## Providers | Name | Version | |------|---------| | [aws](#provider\_aws) | >= 2.0 | -| [template](#provider\_template) | >= 2.0 | ## Modules | Name | Source | Version | |------|--------|---------| -| [autoscale\_group](#module\_autoscale\_group) | cloudposse/ec2-autoscale-group/aws | 0.25.0 | +| [autoscale\_group](#module\_autoscale\_group) | cloudposse/ec2-autoscale-group/aws | 0.30.1 | | [label](#module\_label) | cloudposse/label/null | 0.24.1 | | [this](#module\_this) | cloudposse/label/null | 0.24.1 | @@ -229,7 +227,6 @@ Available targets: | [aws_ami.eks_worker](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ami) | data source | | [aws_iam_instance_profile.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_instance_profile) | data source | | [aws_iam_policy_document.assume_role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source | -| [template_file.userdata](https://registry.terraform.io/providers/hashicorp/template/latest/docs/data-sources/file) | data source | ## Inputs diff --git a/docs/terraform.md b/docs/terraform.md index 9bf3542..d61ce5c 100644 --- a/docs/terraform.md +++ b/docs/terraform.md @@ -5,20 +5,18 @@ |------|---------| | [terraform](#requirement\_terraform) | >= 0.13 | | [aws](#requirement\_aws) | >= 2.0 | -| [template](#requirement\_template) | >= 2.0 | ## Providers | Name | Version | |------|---------| | [aws](#provider\_aws) | >= 2.0 | -| [template](#provider\_template) | >= 2.0 | ## Modules | Name | Source | Version | |------|--------|---------| -| [autoscale\_group](#module\_autoscale\_group) | cloudposse/ec2-autoscale-group/aws | 0.25.0 | +| [autoscale\_group](#module\_autoscale\_group) | cloudposse/ec2-autoscale-group/aws | 0.30.1 | | [label](#module\_label) | cloudposse/label/null | 0.24.1 | | [this](#module\_this) | cloudposse/label/null | 0.24.1 | @@ -41,7 +39,6 @@ | [aws_ami.eks_worker](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ami) | data source | | [aws_iam_instance_profile.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_instance_profile) | data source | | [aws_iam_policy_document.assume_role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source | -| [template_file.userdata](https://registry.terraform.io/providers/hashicorp/template/latest/docs/data-sources/file) | data source | ## Inputs diff --git a/examples/complete/versions.tf b/examples/complete/versions.tf index cc861b8..d62920a 100644 --- a/examples/complete/versions.tf +++ b/examples/complete/versions.tf @@ -6,10 +6,6 @@ terraform { source = "hashicorp/aws" version = ">= 2.0" } - template = { - source = "hashicorp/template" - version = ">= 2.0" - } local = { source = "hashicorp/local" version = ">= 1.3" diff --git a/main.tf b/main.tf index 5442d5f..aef9e43 100644 --- a/main.tf +++ b/main.tf @@ -6,6 +6,16 @@ locals { workers_role_arn = var.use_existing_aws_iam_instance_profile ? join("", data.aws_iam_instance_profile.default.*.role_arn) : join("", aws_iam_role.default.*.arn) workers_role_name = var.use_existing_aws_iam_instance_profile ? join("", data.aws_iam_instance_profile.default.*.role_name) : join("", aws_iam_role.default.*.name) + + userdata = templatefile("${path.module}/userdata.tpl", { + cluster_endpoint = var.cluster_endpoint + certificate_authority_data = var.cluster_certificate_authority_data + cluster_name = var.cluster_name + bootstrap_extra_args = var.bootstrap_extra_args + kubelet_extra_args = var.kubelet_extra_args + before_cluster_joining_userdata = var.before_cluster_joining_userdata + after_cluster_joining_userdata = var.after_cluster_joining_userdata + }) } module "label" { @@ -146,21 +156,6 @@ data "aws_ami" "eks_worker" { owners = ["602401143452"] # Amazon } -data "template_file" "userdata" { - count = local.enabled ? 1 : 0 - template = file("${path.module}/userdata.tpl") - - vars = { - cluster_endpoint = var.cluster_endpoint - certificate_authority_data = var.cluster_certificate_authority_data - cluster_name = var.cluster_name - bootstrap_extra_args = var.bootstrap_extra_args - kubelet_extra_args = var.kubelet_extra_args - before_cluster_joining_userdata = var.before_cluster_joining_userdata - after_cluster_joining_userdata = var.after_cluster_joining_userdata - } -} - data "aws_iam_instance_profile" "default" { count = local.enabled && var.use_existing_aws_iam_instance_profile ? 1 : 0 name = var.aws_iam_instance_profile_name @@ -168,7 +163,7 @@ data "aws_iam_instance_profile" "default" { module "autoscale_group" { source = "cloudposse/ec2-autoscale-group/aws" - version = "0.25.0" + version = "0.30.1" enabled = local.enabled tags = merge(local.tags, var.autoscaling_group_tags) @@ -185,7 +180,7 @@ module "autoscale_group" { ) ) - user_data_base64 = base64encode(join("", data.template_file.userdata.*.rendered)) + user_data_base64 = base64encode(local.userdata) instance_type = var.instance_type subnet_ids = var.subnet_ids diff --git a/versions.tf b/versions.tf index 4b24f8b..c2352c7 100644 --- a/versions.tf +++ b/versions.tf @@ -6,9 +6,5 @@ terraform { source = "hashicorp/aws" version = ">= 2.0" } - template = { - source = "hashicorp/template" - version = ">= 2.0" - } } }