Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Merged
merged 1 commit into from
Jun 9, 2022
Merged

Conversation

kylecarbs
Copy link
Member

This was regressed in #2187. There was bad testing around this
before, and this should prevent a similar situation from happening
again!

@kylecarbs kylecarbs requested a review from deansheather June 9, 2022 12:59
@kylecarbs kylecarbs self-assigned this Jun 9, 2022
@kylecarbs kylecarbs requested a review from johnstcn June 9, 2022 13:03
@johnstcn johnstcn requested a review from mafredri June 9, 2022 13:06
Copy link
Member

@johnstcn johnstcn left a 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!
@kylecarbs kylecarbs force-pushed the instanceassociation branch from 83651bc to bc84d9f Compare June 9, 2022 13:21
@kylecarbs kylecarbs enabled auto-merge (squash) June 9, 2022 13:21
@kylecarbs kylecarbs merged commit fff59ef into main Jun 9, 2022
@kylecarbs kylecarbs deleted the instanceassociation branch June 9, 2022 13:34
Copy link
Member

@mafredri mafredri left a 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]
Copy link
Member

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 😄

Copy link
Member Author

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.

Copy link
Member

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.

kylecarbs added a commit that referenced this pull request Jun 10, 2022
This was regressed in #2187. There was bad testing around this
before, and this should prevent a similiar situation from happening
again!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants