热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

DependencyviolationwhendeletingaSubnet:ENIstillattachedtoELB

Thisissuewasoriginallyopenedby-nashashicorp/terraform#6318.Itwasmigrated

This issue was originally opened by -n as hashicorp/terraform#6318. It was migrated here as part of the provider split. The original body of the issue is below.

Hi,

I'm currently seeing terraform tries to destroy a subnet that was used in ELB and fails. I think its because ENI interface that belongs to the subnet is still attached to ELB. The subnet itself is removed from ELB correctly via ASG routine.

Terraform Version

v0.6.14

Actual Behavior

When I remove a subnet from vars, terraform correctly removes it from ASG/ELB. But it hangs at the subnet destroying step.

Workaround is to manually detach ENI(s) that belong to subnet and delete it.

1
2
3
4
5
6
7
aws_autoscaling_group.wp_asg: Refreshing state... (ID: wp-staging-qmlts6tb7fb3va6r3xe5glsie4-asg)

aws_subnet.blog_subnets.2: Refreshing state... (ID: subnet-c21543ff)

aws_subnet.blog_subnets.2: Destroying...



aws_subnet.blog_subnets.2: Destruction complete



Apply complete! Resources: 0 added, 0 changed, 1 destroyed.


Steps to Reproduce

Create an ELB with ASG that uses few subnets. Remove 1 subnet.
Watch ASG/ELB gets updated properly, but terraform hangs on subnet termination. If I try to delete subnet manually in aws interface - it complaines about attached ENI.

1
2
3
4
resource "aws_elb" "wp_elb" {

name = foo

subnets = ["${split(",", join(",", aws_subnet.app_subnets.*.id))}"]

}

Could be related to hashicorp/terraform#934

该提问来源于开源项目:hashicorp/terraform-provider-aws

I managed to reliably reproduce this using the following config:
https://gist.github.com/radeksimko/4132453a6cf6edc3ccb61c8bbe31e076



As mentioned already this is triggered by deletion of a subnet which is associated with an LB.

Sadly though there doesn't seem to be anything we can realistically do from Terraform's perspective. Even if we got the ordering of operations right and managed to disassociate the subnet from LB before attempting to delete it, Amazon wouldn't let us detach these ENIs as they hold them until the LB is fully destroyed. You will get the following error when attempting to do so:



An error occurred (AuthFailure) when calling the DetachNetworkInterface operation: You do not have permission to access the specified resource.

I am not sure if this is by design. Perhaps we could get some explanation from the LB/EC2 teams?


   



推荐阅读
author-avatar
sl51866
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有