簡體   English   中英

Terraform - 當它是端點服務的一部分時無法刪除負載均衡器

[英]Terraform - could not delete loadbalancer when its part of a endpoint service

在對 end_point 服務進行一些更改(例如添加新標簽)后,網絡負載均衡器在運行terraform apply時首先嘗試刪除,但由於 NLB 與 endpoint_service 相關聯,因此它不會成功。

端點服務應該是第一個被刪除的,所以網絡負載均衡器應該在之后被刪除。

有沒有辦法設置哪個應該先刪除?

module.Tester_vpc.data.aws_instances.webservers: Refreshing state...

Error: Error deleting LB: ResourceInUse: Load balancer 'arn:aws:elasticloadbalancing:ap-south-1:123456:loadbalancer/net/myNLB/123456' cannot be deleted because it is currently associated with another service
        status code: 400, request id: 25944b2d-49c7-1234-a32c-faeb6e2e7c7f

這是 NLB 資源。

resource "aws_vpc_endpoint_service" "nlb_service" {

  count = var.create_lb ? 1 : 0
  acceptance_required = false
  network_load_balancer_arns = [aws_lb.myNLB[0].arn]
}

resource "aws_vpc_endpoint" "service_consumer" {

  count = var.create_lb ? 1 : 0
  vpc_id = data.aws_vpc.vpc_id.id
  subnet_ids = data.aws_subnet_ids.private_subnet_ids.ids
  security_group_ids = [data.aws_security_group.sG_myVPC.id]
  vpc_endpoint_type   = "Interface"
  private_dns_enabled = false
  service_name        = aws_vpc_endpoint_service.nlb_service[0].service_name

  tags = {
    Name = "tester_service" # When adding a tag, NLB attemps get deleted first and fails.
  }
}

可能你必須手動完成。 github 上存在針對該有問題的依賴項的未解決問題,但仍未解決:

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM