Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

466
Vistas
El error aws_alb_target_group tiene "recuento" establecido, se debe acceder a sus atributos en instancias específicas

Estoy usando Terraform v0.12.26 y configuré aws_alb_target_group como:

 resource "aws_alb_target_group" "my-group" { count = "${length(local.target_groups)}" name = "${var.namespace}-my-group-${ element(local.target_groups, count.index) }" port = 8081 protocol = "HTTP" vpc_id = var.vpc_id health_check { healthy_threshold = var.health_check_healthy_threshold unhealthy_threshold = var.health_check_unhealthy_threshold timeout = var.health_check_timeout interval = var.health_check_interval path = var.path } tags = { Name = var.namespace } lifecycle { create_before_destroy = true } }

Los lugareños se parecen a:

 locals { target_groups = [ "green", "blue", ] }

Cuando ejecuto terraform apply devuelve el siguiente error:

 Error: Missing resource instance key on ../../modules/aws_alb/outputs.tf line 3, in output "target_groups_arn": 3: aws_alb_target_group.http.arn, Because aws_alb_target_group.http has "count" set, its attributes must be accessed on specific instances. For example, to correlate with indices of a referring resource, use: aws_alb_target_group.http[count.index]

Seguí esta implementación

¿Alguna idea de cómo arreglarlo?

Producción

 output "target_groups_arn" { value = [ aws_alb_target_group.http.arn, ] }
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Dado que aws_alb_target_group.http es un recurso contado, deberá hacer referencia a instancias específicas por índice o todas ellas como una lista con [*] (también conocido como Splat Expressions ) de la siguiente manera:

 output "target_groups_arn" { value = aws_alb_target_group.http[*].arn, }

La salida target_groups_arn será una lista de los ARN de TG.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda