UPD: added default_tags validation
This commit is contained in:
parent
fc88634341
commit
c3b62a163b
@ -3,10 +3,7 @@ resource "aws_security_group" "sg" {
|
||||
name = var.security-groups[count.index].name
|
||||
description = var.security-groups[count.index].description
|
||||
vpc_id = var.vpc-id
|
||||
tags = merge(
|
||||
var.tags,
|
||||
{Name = var.security-groups[count.index].name}
|
||||
)
|
||||
tags = { Name = var.security-groups[count.index].name }
|
||||
}
|
||||
|
||||
// see https://www.terraform.io/docs/configuration/functions/flatten.html
|
||||
|
@ -1,4 +1,11 @@
|
||||
data aws_default_tags this {}
|
||||
data "aws_default_tags" "this" {
|
||||
lifecycle {
|
||||
postcondition {
|
||||
condition = length(self.tags) >= 1
|
||||
error_message = "Validation failed: Provider default_tags not set."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
resource "aws_security_group" "sg" {
|
||||
name = var.name
|
||||
|
Loading…
Reference in New Issue
Block a user