Amazon web services 如何将地形资源绑定到实例';生命周期?

Amazon web services 如何将地形资源绑定到实例';生命周期?,amazon-web-services,devops,terraform,Amazon Web Services,Devops,Terraform,我正在尝试使用Terraform和spot实例为非prod开发工作区设置ALB。spot实例已创建,但在尝试使用aws\u alb\u目标组\u附件中的实例时,我收到一个错误: * aws_alb_target_group_attachment.ui_servers: Error registering targets with target group: InvalidTarget: The following targets are not in a running state and ca

我正在尝试使用Terraform和spot实例为非prod开发工作区设置ALB。spot实例已创建,但在尝试使用aws\u alb\u目标组\u附件中的实例时,我收到一个错误:

* aws_alb_target_group_attachment.ui_servers: Error registering targets with target group: InvalidTarget: The following targets are not in a running state and cannot be registered: '[id]'
        status code: 400, request id: [id]
即使我在附件中添加了
dependens\u
指令,这种情况仍然存在:

depends_on = ["data.aws_instance.workspace_gz"]

如果我重新运行
terraform应用程序
,它会工作,因此它实际上只是一个生命周期问题。如何指示附件等待实例正常运行?

您没有。您应该做的是在中为spot实例创建spot实例,并将ASG附加到目标组