Error with default AWS DHCP with Terraform

Viewed 203

I've got an error while I'm trying to add some tags to default DHCP while VPC is creating.

Error: Multiple default DHCP Options Sets found

As it is not associated with VPC, it should not give me any errors, but I can not fix it. Here is a new DHCP determination:

resource "aws_vpc_dhcp_options" "dhcp" {
   count                             = var.create_network && var.enable_dhcp_supporting ? 1 : 0
   depends_on                        = [aws_vpc.network]

   ntp_servers                       = var.ntp_servers
   domain_name                       = var.domain_name
   domain_name_servers               = var.domain_servers
   netbios_name_servers              = var.netbios_name
   netbios_node_type                 = var.netbios_type
   
   # ^ Resource Lifecycle ! Timeouts Does Not Supported
   lifecycle { create_before_destroy = true } 
   tags = merge(
     {
         "Name"  = join(" | ", [
             format("%s Network | ${var.dhcp_tag} · %s", var.identity_tags, var.master_cidrblock_ipvf),
             upper(var.region)
         ])
     },
     var.resource_tags,
     var.optional_tags,
   )
} 

Here is the default DHCP determination:

resource "aws_default_vpc_dhcp_options" "dhcp_default" {
   tags = merge(
     {
         "Name"  = join(" | ", [
             format("%s Network | Default ${var.dhcp_tag} · %s", var.identity_tags, var.master_cidrblock_ipvf),
             upper(var.region)
         ])
     },
     var.resource_tags,
     var.optional_tags,
   )
}

As you may see, I'm working with non default DHCP, but the default DHCP should apply those changes

0 Answers
Related