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

Using license_specifications into terraform EKS self_managed_node_group module #2753

Closed
palpaga opened this issue Sep 20, 2023 · 5 comments · Fixed by #2796
Closed

Using license_specifications into terraform EKS self_managed_node_group module #2753

palpaga opened this issue Sep 20, 2023 · 5 comments · Fixed by #2796

Comments

@palpaga
Copy link
Contributor

palpaga commented Sep 20, 2023

Description

I'm encountering an issue while attempting to define license_specifications within my Terraform configuration.
The error message I'm getting A managed resource "license_specifications" "value" has not been declared in module.self_managed_node_group

Versions

Terraform v1.5.6 on darwin_arm64

  • provider registry.terraform.io/hashicorp/aws v5.15.0

  • provider registry.terraform.io/hashicorp/kubernetes v2.23.0

  • module AWS EKS version 19.16.0

Code

module "self_managed_node_group" {
  source  = "terraform-aws-modules/eks/aws//modules/self-managed-node-group"
  version = "19.16.0"

  name                = local.eks_name
  cluster_name        = module.eks.cluster_name
  cluster_version     = var.eks_version
  cluster_endpoint    = module.eks.cluster_endpoint
  cluster_auth_base64 = module.eks.cluster_certificate_authority_data

  ....

  placement = {
    tenancy                 = "host"
    host_resource_group_arn = "arn:aws:resource-groups:us-east-1:XXXXXXX:group/XXXXXX"
  }

  license_specifications = {
    license_configuration_arn = "arn:aws:license-manager:us-east-1:XXXXXX:license-configuration:XXXXXXXXX"
  }
}

Output

 Error: Reference to undeclared resource
│ 
│   on .terraform/modules/self_managed_node_group/modules/self-managed-node-group/main.tf line 288, in resource "aws_launch_template" "this":288:       license_configuration_arn = license_specifications.value.license_configuration_arn
│ 
│ .

Additional context

It works by applying this modification to the dynamic block:

  dynamic "license_specification" {
    for_each = length(var.license_specifications) > 0 ? var.license_specifications : []

    content {
      license_configuration_arn = license_specification.value.license_configuration_arn
    }
  }

conf

  license_specifications = [
    {
      license_configuration_arn = "arn:aws:license-manager:us-east-1:XXXXXX:license-configuration:lic-XXXXXXXXX"
    }
  ]

from

license_configuration_arn = license_specifications.value.license_configuration_arn

But this change probably isn't the best ide, it doesn't make sense to add the map to a list in this case.

@github-actions
Copy link

This issue has been automatically marked as stale because it has been open 30 days
with no activity. Remove stale label or comment or this issue will be closed in 10 days

@github-actions github-actions bot added the stale label Oct 21, 2023
@palpaga
Copy link
Contributor Author

palpaga commented Oct 30, 2023

I think that the extra 's' in license_configuration_arn = license_specificationS.value.license_configuration_arn

license_configuration_arn = license_specifications.value.license_configuration_arn

is the cause of the Reference to undeclared resource

@bryantbiggs
Copy link
Member

yep, that looks incorrect. feel free to open a PR and I'll merge it, thanks!

@antonbabenko
Copy link
Member

This issue has been resolved in version 19.17.3 🎉

Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants