Skip to content
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

Update Agent Pools scope to Workspaces #870

Merged
merged 7 commits into from
Jun 26, 2023

Conversation

hs26gill
Copy link
Contributor

@hs26gill hs26gill commented Apr 28, 2023

Description

This PR updates the Agent Pools resource and data source to allow users to scope an Agent Pool to particular workspaces.

Testing plan

Covered by integration tests

External links

@hs26gill hs26gill force-pushed the hs26gill/TF-3175-add-scoping-agent-pools-to-workspaces branch 4 times, most recently from ff123d4 to f820046 Compare April 28, 2023 19:57
@hs26gill hs26gill marked this pull request as ready for review April 28, 2023 19:58
@hs26gill hs26gill requested a review from a team as a code owner April 28, 2023 19:58
@rhughes1
Copy link
Contributor

rhughes1 commented May 5, 2023

Might be a bit of scope creep for this feature, but was thinking about if it would be possible in also having a resource dedicated to creating that link between the workspace and agent pool? ie Something like this:

resource "tfe_workspace_agent_pool" "ws" {
  agent_pool_id = "apool-123456"
  workspace_id  = "test"
}

The idea is similar to something like the workspace_variable_set resource. With this new change, we're making an assumption that the workspace(s) already exist. This doesn't automatically change the execution mode to agent for those given workspaces, this is simply a governance piece saying only these workspaces could use this agent pool.

@hs26gill hs26gill force-pushed the hs26gill/TF-3175-add-scoping-agent-pools-to-workspaces branch 2 times, most recently from 5f1f22c to 750038f Compare May 10, 2023 15:40
@hs26gill hs26gill force-pushed the hs26gill/TF-3175-add-scoping-agent-pools-to-workspaces branch from 750038f to 6f1acec Compare May 11, 2023 16:05
@hs26gill hs26gill force-pushed the hs26gill/TF-3175-add-scoping-agent-pools-to-workspaces branch 4 times, most recently from f1c83f4 to 0e35f18 Compare May 11, 2023 18:49
Copy link
Contributor

@jbonhag jbonhag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good! Added a few comments, some stuff will not pass the linter until hashicorp/go-tfe#701 gets merged.

CHANGELOG.md Outdated Show resolved Hide resolved
go.mod Outdated Show resolved Hide resolved
Comment on lines +30 to +34
"allowed_workspace_ids": {
Type: schema.TypeSet,
Computed: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this move to its own data source in order to align with the tfe_agent_pool_allowed_workspaces resource?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This resource only adds the workspace to the allowed_workspaces attribute of an agent_pool. So this was kept inside the agent_pool data source similar to the team_organization_members

tfe/resource_tfe_agent_pool_allowed_workspaces.go Outdated Show resolved Hide resolved
tfe/resource_tfe_agent_pool_allowed_workspaces.go Outdated Show resolved Hide resolved
tfe/resource_tfe_agent_pool_allowed_workspaces_test.go Outdated Show resolved Hide resolved
website/docs/d/agent_pool.html.markdown Outdated Show resolved Hide resolved
website/docs/d/agent_pool.html.markdown Outdated Show resolved Hide resolved
website/docs/r/agent_pool.html.markdown Show resolved Hide resolved
website/docs/r/agent_pool_allowed_workspaces.html.markdown Outdated Show resolved Hide resolved
@hs26gill hs26gill force-pushed the hs26gill/TF-3175-add-scoping-agent-pools-to-workspaces branch 3 times, most recently from 4da75e7 to 9b6704d Compare May 12, 2023 20:16
@joekarl joekarl force-pushed the hs26gill/TF-3175-add-scoping-agent-pools-to-workspaces branch 3 times, most recently from e445795 to fc3f410 Compare June 23, 2023 15:04
@joekarl joekarl force-pushed the hs26gill/TF-3175-add-scoping-agent-pools-to-workspaces branch 3 times, most recently from ee34250 to 9fe9a86 Compare June 23, 2023 17:35
@joekarl joekarl force-pushed the hs26gill/TF-3175-add-scoping-agent-pools-to-workspaces branch from 9fe9a86 to d1ef6a5 Compare June 23, 2023 17:36
Copy link
Collaborator

@uturunku1 uturunku1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test passing 🎉

@joekarl joekarl merged commit f757261 into main Jun 26, 2023
@joekarl joekarl deleted the hs26gill/TF-3175-add-scoping-agent-pools-to-workspaces branch June 26, 2023 15:19
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.

6 participants