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

Circular dependency in tfe_workspace using execution_mode=agent and tfe_agent_pool_allowed_workspaces #1111

Open
megrehncitrix opened this issue Oct 24, 2023 · 1 comment
Labels

Comments

@megrehncitrix
Copy link

megrehncitrix commented Oct 24, 2023

Terraform Cloud/Enterprise version

Terraform Cloud

Terraform version

1.3.4

Terraform Configuration Files

resource "tfe_workspace" "example-workspace" {
  name               = "example"
  organization       = "example-org"
  allow_destroy_plan = false
  agent_pool_id      = tfe_agent_pool.org-agent-pool.id
  execution_mode     = "agent"
}

resource "tfe_agent_pool_allowed_workspaces" "example-agent-pool-scope" {
  agent_pool_id         = tfe_agent_pool.org-agent-pool.id
  allowed_workspace_ids = [tfe_workspace.example-workspace.id]
}

Debug Output

╷
│ Error: Error creating workspace example-workspace for organization example-org: invalid attribute
│ 
│ Agent pool workspace does not have access to use this agent pool
│ 
│   with tfe_workspace.example-workspace,
│   on workspaces.tf line 15, in resource "tfe_workspace" "example-workspace":
│   15: resource "tfe_workspace" "example-workspace" {

Expected Behavior

The workspace should be created with the intended agent pool as its execution mode.

Actual Behavior

Workspace cannot be created and configured accordingly. Agent pool id is required if execution_mode is set to agent.

Additional Context

Seen during new workspace creation.
The desire in this configuration it to create and control which workspaces have access to which agent pools.

Possible solution: allow tfe_workspace to configure allowed workspaces for the target agent pool id if the caller has appropriate permissions.

@zeidlerb
Copy link

I think is issue has been effectively resolved with the introduction of tfe_workspace_settings in version 0.51.0. The execution mode can now be set after the workspace has been created and the pool has been assigned.

I vote to close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants