Invalid type for Security Groups
Closed this issue · 2 comments
security_groups config is defined to be a single string value
We try to run our terraform code today without changing anything and we start getting this error:
Error: Incorrect attribute value type
in resource "aws_lb" "main":
7: security_groups = aws_security_group.main[0].id
Inappropriate value for attribute "security_groups": set of string required.
Steps to reproduce
-
Create a module:
module "alb_for_service_x" {
source = "umotif-public/alb/aws"
version = "~> 2.2"name_prefix = "app"
load_balancer_type = "application"
internal = false
vpc_id = var.vpc_id
subnets = var.public_subnets_ids
description = "Load Balancer - Managed by Terraform"
} -
run terraform plan
-
After that we get an error in the console
I just look further and find out that maybe our provider version dont match and that's why we get the error
terraform {
required_version = "~>1.4"
backend "http" {
}
required_providers {
aws = {
version = "~> 4.45"
}
}
}
I think maybe this change is what is affecting us
From: aws_security_group.main.*.id
to: aws_security_group.main[0].id
Commit: https://github.com/umotif-public/terraform-aws-alb/commit/721450c96caaf8c01e5e703a950d1d1ce603eb52
The security groups should be set as an array/set
Affected vesion 2.2?
In version 2.0 and 2.1 it works
I just opened a pull request
@marcincuber @Ohid25 @umotif-olascu @Mohammed-afk91 could you please take a look. :-D
Thank you and sorry for disturbing. your day. :-D