-
Notifications
You must be signed in to change notification settings - Fork 955
Closed
Labels
s2Broken use cases or features (with a workaround). Only humans may set this.Broken use cases or features (with a workaround). Only humans may set this.
Description
Version: v0.26.1+a0fedeb
Problem
I have made a template to start an AWS EC2 instance similar to the example template except instead of using the conditional startup script found in that template I am using the newer aws_ec2_instance_state
like so:
resource "aws_ec2_instance_state" "control" {
instance_id = aws_instance.main.id
state = var.coder_workspace.transition == "start" ? "running" : "stopped"
}
A couple issues arise with this though.
- Regardless of whether I use the old or new method, after stopping an instance, the UI continues to show the agent is trying to load. This doesn't make sense to me since Coder has marked the agent as stopped, I can see the EC2 instance is stopped in AWS, but yet the Coder UI seems confused.
- When I try to get around this by conditionally hiding the resource with the
coder_metadata
resource as seen below, I get the following error:
resource "coder_metadata" "conditional_ec2_hide" {
resource_id = module.ec2_instance.aws_instance.id
hide = data.coder_workspace.me.transition != "start"
}
running command "coder templates create": template import provision for start: recv import provision: plan terraform: duplicate metadata resource: module.ec2_instance.aws_instance.main
This is because aws_instance
and aws_ec2_instance_state
understandably have the same resource ID.
Solution
Either issue 1.
needs to be fixed so that Coder doesn't show the agent trying to connect when stopped and/or, there should be a way to handle resources that have the same ID (2.
).
Metadata
Metadata
Assignees
Labels
s2Broken use cases or features (with a workaround). Only humans may set this.Broken use cases or features (with a workaround). Only humans may set this.