-
Notifications
You must be signed in to change notification settings - Fork 881
fix: Add tests for instance and app association #2198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not as familiar with this part of the codebase, but this proposed change LGTM!
This was regressed in #2187. There was bad testing around this before, and this should prevent a similiar situation from happening again!
83651bc
to
bc84d9f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
"aws_instance": "id", | ||
"azurerm_linux_virtual_machine": "id", | ||
"azurerm_windows_virtual_machine": "id", | ||
}[resource.Type] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I'm still pretty noobish when it comes to Terraform, but it seems like we're automatically mapping these resource types for all agents. So for instance if there's both a google_compute_instance
, and an aws_instance
, one would overwrite the other?
I'm sure the above wouldn't be a common use case, but I imagine it would be possible to create a semi-complex Terraform template with multiple providers depending on certain selections? And I imagine this would be a use-case for having multiple agents, are there others?
If my questions make no sense, feel free to disregard 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If my questions make no sense, feel free to disregard 😄
All questions I'm happy to answer!
So for instance if there's both a google_compute_instance, and an aws_instance, one would overwrite the other?
There's a one -> many mapping of resource to agent. If a resource isn't using token authentication, we assume it's using the zero-trust providers we support: *-instance-identity
under the auth
parameter on an agent. An instance ID can be manually associated with the coder_agent_instance
resource, but we automatically associate it with one of the listed resource types. There isn't an explicit reason we need to do this, and it might end up adding more confusion, so it's not impossible we remove it at some point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, thanks for clarifying @kylecarbs! I don't think we need to make any changes to it at this point, but good to be aware of it.
This was regressed in #2187. There was bad testing around this before, and this should prevent a similiar situation from happening again!
This was regressed in #2187. There was bad testing around this
before, and this should prevent a similar situation from happening
again!