Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aws_launch_template Tag on create values cannot be empty #11164

Open
benwj opened this issue Dec 5, 2019 · 0 comments
Open

aws_launch_template Tag on create values cannot be empty #11164

benwj opened this issue Dec 5, 2019 · 0 comments
Labels
bug Addresses a defect in current functionality. service/ec2 Issues and PRs that pertain to the ec2 service.

Comments

@benwj
Copy link

benwj commented Dec 5, 2019

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

Terraform: 11.7
AWS Provider: 2.40

Affected Resource(s)

  • aws_launch_template

Terraform Configuration Files

resource "aws_launch_template" "kube-submaster-lt" {
  count         = "${length(var.aws_kube_subnets)}"
  name_prefix   = "${var.kube_cluster_name}-kube-master_${local.environment_name}-${var.kube_type}"
  ebs_optimized = true
  image_id      = "${local.ami}"

  #instance_initiated_shutdown_behavior = "terminate"
  instance_type = "${var.mixed_instance_types[0]}"
  key_name      = "${var.key_name}"

  lifecycle {
    create_before_destroy = true
    ignore_changes        = ["block_device_mappings"]
  }

  block_device_mappings {
    device_name = "/dev/sdi"

    ebs {
      volume_type           = "gp2"
      volume_size           = "${var.kubelet_vol_size}"
      delete_on_termination = true
      encrypted             = true
    }
  }

  block_device_mappings {
    device_name = "/dev/xvda"

    ebs {
      delete_on_termination = true
      volume_size           = "50"
      encrypted             = ""
      volume_type           = "gp2"
    }
  }

  iam_instance_profile {
    name = "${aws_iam_instance_profile.kubemaster_instance_profile.name}"
  }

  monitoring {
    enabled = true
  }

  placement {
    tenancy = "${var.placement_tenancy}"

    #group_name = "${aws_placement_group.launch_template_placement.*.id[count.index]}"
  }
  vpc_security_group_ids = ["${aws_security_group.kubecluster.id}", "${var.aws_ssh_security_groups}", "${aws_security_group.kube_master_lb_sg.id}"]

  user_data = "${base64encode(data.template_file.ignition_sub.rendered)}"
  tags      = "${local.common_tags}"

  tag_specifications {
    resource_type = "volume"
    tags          = "${local.common_tags}"
  }
}

locals {
  common_tags = "${merge(map(
        "kubernetes.io/cluster/${var.kube_cluster_name}", "owned",
        "KubeClusterId" , "${var.kube_cluster_id}${var.cluster_swap}",
        "KubeEnv" , "${var.kube_env}",
        "KubeType" , "${var.kube_type }",
        "Name" , "${var.kube_cluster_name}-kube-master-${local.environment_name}${var.cluster_swap}",),
      "${var.tags}")}"
}

Expected Behavior

Launch Template is created successfully

Actual Behavior

Error: Error applying plan:

3 error(s) occurred:

* module.kube-controlplane.aws_launch_template.kube-submaster-lt[0]: 1 error(s) occurred:

* aws_launch_template.kube-submaster-lt.0: InvalidParameterValue: Tag keys and tag values cannot be empty. Ensure that each tag has a key and value pair and try again.
	status code: 400, request id: df0d8920-eb70-4de9-ae39-6f4a0f53d19e
* module.kube-controlplane.aws_launch_template.kube-submaster-lt[1]: 1 error(s) occurred:

* aws_launch_template.kube-submaster-lt.1: InvalidParameterValue: Tag keys and tag values cannot be empty. Ensure that each tag has a key and value pair and try again.
	status code: 400, request id: 62f93d67-6462-46d9-b56d-7df5b0ffbf32
* module.kube-controlplane.aws_launch_template.kube-submaster-lt[2]: 1 error(s) occurred:

* aws_launch_template.kube-submaster-lt.2: InvalidParameterValue: Tag keys and tag values cannot be empty. Ensure that each tag has a key and value pair and try again.
	status code: 400, request id: 602537fd-2de5-4ab2-b8f4-c84dd4f4eb8b

Steps to Reproduce

Create a launch template with empty tag values

Important Factoids

The same code works in version 2.23 of the provider and fails in 2.40

@ghost ghost added the service/ec2 Issues and PRs that pertain to the ec2 service. label Dec 5, 2019
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Dec 5, 2019
@justinretzolk justinretzolk added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Sep 27, 2021
@ewbankkit ewbankkit added this to the v5.0.0 milestone May 11, 2023
@johnsonaj johnsonaj modified the milestones: v5.0.0, v5.1.0 May 24, 2023
@ewbankkit ewbankkit removed this from the v5.1.0 milestone Jun 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Addresses a defect in current functionality. service/ec2 Issues and PRs that pertain to the ec2 service.
Projects
None yet
Development

No branches or pull requests

4 participants