Skip to content

Commit a6350e8

Browse files
committed
cdktf: update index.html.markdown,r/workspace_variable_set.html.markdown,r/workspace_settings.markdown,r/workspace_run_task.html.markdown,r/workspace_run.html.markdown,r/workspace_policy_set_exclusion.html.markdown,r/workspace_policy_set.html.markdown,r/workspace.html.markdown,r/variable_set.html.markdown,r/variable.html.markdown
1 parent 3f4ed7f commit a6350e8

File tree

4 files changed

+370
-46
lines changed

4 files changed

+370
-46
lines changed

website/docs/cdktf/python/r/workspace.html.markdown

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ description: |-
1111

1212
Provides a workspace resource.
1313

14+
~> **NOTE:** Setting the execution mode and agent pool affinity directly on the workspace is deprecated in favor of using both [tfe_workspace_settings](workspace_settings) and [tfe_organization_default_settings](organization_default_settings), since they allow more precise control and fully support [agent_pool_allowed_workspaces](agent_pool_allowed_workspaces). Use caution when unsetting `execution_mode`, as it now leaves any prior value unmanaged instead of reverting to the old default value of `"remote"`.
15+
1416
~> **NOTE:** Using `global_remote_state` or `remote_state_consumer_ids` requires using the provider with Terraform Cloud or an instance of Terraform Enterprise at least as recent as v202104-1.
1517

1618
## Example Usage
@@ -41,7 +43,7 @@ class MyConvertedCode(TerraformStack):
4143
)
4244
```
4345

44-
With `execution_mode` of `agent`:
46+
Usage with vcs_repo:
4547

4648
```python
4749
# DO NOT EDIT. Code generated by 'cdktf convert' - Please report bugs at https://cdk.tf/bug
@@ -51,7 +53,7 @@ from cdktf import TerraformStack
5153
# Provider bindings are generated by running `cdktf get`.
5254
# See https://cdk.tf/provider-generation for more details.
5355
#
54-
from imports.tfe.agent_pool import AgentPool
56+
from imports.tfe.oauth_client import OauthClient
5557
from imports.tfe.organization import Organization
5658
from imports.tfe.workspace import Workspace
5759
class MyConvertedCode(TerraformStack):
@@ -61,15 +63,22 @@ class MyConvertedCode(TerraformStack):
6163
6264
name="my-org-name"
6365
)
64-
test_agent_pool = AgentPool(self, "test-agent-pool",
65-
name="my-agent-pool-name",
66-
organization=test_organization.name
66+
test = OauthClient(self, "test",
67+
api_url="https://api.github.com",
68+
http_url="https://github.com",
69+
oauth_token="oauth_token_id",
70+
organization=test_organization,
71+
service_provider="github"
6772
)
68-
Workspace(self, "test",
69-
agent_pool_id=test_agent_pool.id,
70-
execution_mode="agent",
71-
name="my-workspace-name",
72-
organization=test_organization.name
73+
Workspace(self, "parent",
74+
name="parent-ws",
75+
organization=test_organization,
76+
queue_all_runs=False,
77+
vcs_repo=WorkspaceVcsRepo(
78+
branch="main",
79+
identifier="my-org-name/vcs-repository",
80+
oauth_token_id=test.oauth_token_id
81+
)
7382
)
7483
```
7584

@@ -78,20 +87,13 @@ class MyConvertedCode(TerraformStack):
7887
The following arguments are supported:
7988

8089
* `name` - (Required) Name of the workspace.
81-
* `agent_pool_id` - (Optional) The ID of an agent pool to assign to the workspace. Requires `execution_mode`
82-
to be set to `agent`. This value _must not_ be provided if `execution_mode` is set to any other value or if `operations` is
83-
provided.
90+
* `agent_pool_id` - (Optional) **Deprecated** The ID of an agent pool to assign to the workspace. Use [tfe_workspace_settings](workspace_settings) instead.
8491
* `allow_destroy_plan` - (Optional) Whether destroy plans can be queued on the workspace.
8592
* `assessments_enabled` - (Optional) Whether to regularly run health assessments such as drift detection on the workspace. Defaults to `false`.
8693
* `auto_apply` - (Optional) Whether to automatically apply changes when a Terraform plan is successful. Defaults to `false`.
8794
* `auto_apply_run_trigger` - (Optional) Whether to automatically apply changes for runs that were created by run triggers from another workspace. Defaults to `false`.
8895
* `description` - (Optional) A description for the workspace.
89-
* `execution_mode` - (Optional) Which [execution mode](https://developer.hashicorp.com/terraform/cloud-docs/workspaces/settings#execution-mode)
90-
to use. Using Terraform Cloud, valid values are `remote`, `local` or `agent`.
91-
Defaults your organization's default execution mode, or `remote` if no organization default is set. Using Terraform Enterprise, only `remote` and `local`
92-
execution modes are valid. When set to `local`, the workspace will be used
93-
for state storage only. This value _must not_ be provided if `operations`
94-
is provided.
96+
* `execution_mode` - (Optional) **Deprecated** Which [execution mode](https://developer.hashicorp.com/terraform/cloud-docs/workspaces/settings#execution-mode) to use. Use [tfe_workspace_settings](workspace_settings) instead.
9597
* `file_triggers_enabled` - (Optional) Whether to filter runs based on the changed files
9698
in a VCS push. Defaults to `true`. If enabled, the working directory and
9799
trigger prefixes describe a set of paths which must contain changes for a
@@ -170,9 +172,6 @@ In addition to all arguments above, the following attributes are exported:
170172
* `id` - The workspace ID.
171173
* `resource_count` - The number of resources managed by the workspace.
172174
* `html_url` - The URL to the browsable HTML overview of the workspace.
173-
* `setting_overwrites` - Can be used to check whether a setting is currently inheriting its value from another resource.
174-
- `execution_mode` - Set to `true` if the execution mode of the workspace is being determined by the setting on the workspace itself. It will be `false` if the execution mode is inherited from another resource (e.g. the organization's default execution mode)
175-
- `agent_pool` - Set to `true` if the agent pool of the workspace is being determined by the setting on the workspace itself. It will be `false` if the agent pool is inherited from another resource (e.g. the organization's default agent pool)
176175

177176
## Import
178177

@@ -187,4 +186,4 @@ terraform import tfe_workspace.test ws-CH5in3chf8RJjrVd
187186
terraform import tfe_workspace.test my-org-name/my-wkspace-name
188187
```
189188

190-
<!-- cache-key: cdktf-0.19.0 input-25e2316b67d698d4aec45557feedf54b6a8dfa43a6381d9c433cf7afabed73c9 -->
189+
<!-- cache-key: cdktf-0.19.0 input-1e1393c305fc1bc0e20e87ba524816e7ea2945e6904ebc7678f9fdab56db339f -->
Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
---
2+
layout: "tfe"
3+
page_title: "Terraform Enterprise: tfe_workspace_setting"
4+
description: |-
5+
Manages workspace settings.
6+
---
7+
8+
9+
<!-- Please do not edit this file, it is generated. -->
10+
# tfe_workspace_settings
11+
12+
Manages or reads execution mode and agent pool settings for a workspace. This also interacts with the organization's default values for several settings, which can be managed with [tfe_organization_default_settings](organization_default_settings.html). If other resources need to identify whether a setting is a default or an explicit value set for the workspace, you can refer to the read-only `overwrites` argument.
13+
14+
## Example Usage
15+
16+
Basic usage:
17+
18+
```python
19+
# DO NOT EDIT. Code generated by 'cdktf convert' - Please report bugs at https://cdk.tf/bug
20+
from constructs import Construct
21+
from cdktf import TerraformStack
22+
#
23+
# Provider bindings are generated by running `cdktf get`.
24+
# See https://cdk.tf/provider-generation for more details.
25+
#
26+
from imports.tfe.organization import Organization
27+
from imports.tfe.workspace import Workspace
28+
from imports.tfe.workspace_settings import WorkspaceSettings
29+
class MyConvertedCode(TerraformStack):
30+
def __init__(self, scope, name):
31+
super().__init__(scope, name)
32+
test_organization = Organization(self, "test-organization",
33+
34+
name="my-org-name"
35+
)
36+
test = Workspace(self, "test",
37+
name="my-workspace-name",
38+
organization=test_organization.name
39+
)
40+
WorkspaceSettings(self, "test-settings",
41+
execution_mode="local",
42+
workspace_id=test.id
43+
)
44+
```
45+
46+
With `execution_mode` of `agent`:
47+
48+
```python
49+
# DO NOT EDIT. Code generated by 'cdktf convert' - Please report bugs at https://cdk.tf/bug
50+
from constructs import Construct
51+
from cdktf import TerraformStack
52+
#
53+
# Provider bindings are generated by running `cdktf get`.
54+
# See https://cdk.tf/provider-generation for more details.
55+
#
56+
from imports.tfe.agent_pool import AgentPool
57+
from imports.tfe.agent_pool_allowed_workspaces import AgentPoolAllowedWorkspaces
58+
from imports.tfe.organization import Organization
59+
from imports.tfe.workspace import Workspace
60+
from imports.tfe.workspace_settings import WorkspaceSettings
61+
class MyConvertedCode(TerraformStack):
62+
def __init__(self, scope, name):
63+
super().__init__(scope, name)
64+
test_organization = Organization(self, "test-organization",
65+
66+
name="my-org-name"
67+
)
68+
test = Workspace(self, "test",
69+
name="my-workspace-name",
70+
organization=test_organization.name
71+
)
72+
test_agent_pool = AgentPool(self, "test-agent-pool",
73+
name="my-agent-pool-name",
74+
organization=test_organization.name
75+
)
76+
tfe_agent_pool_allowed_workspaces_test = AgentPoolAllowedWorkspaces(self, "test_3",
77+
agent_pool_id=test_agent_pool.id,
78+
allowed_workspace_ids=[test.id]
79+
)
80+
# This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.
81+
tfe_agent_pool_allowed_workspaces_test.override_logical_id("test")
82+
WorkspaceSettings(self, "test-settings",
83+
agent_pool_id=test_agent_pool.id,
84+
execution_mode="agent",
85+
workspace_id=test.id
86+
)
87+
```
88+
89+
This resource may be used as a data source when no optional arguments are defined:
90+
91+
```python
92+
# DO NOT EDIT. Code generated by 'cdktf convert' - Please report bugs at https://cdk.tf/bug
93+
from constructs import Construct
94+
from cdktf import Token, TerraformOutput, Op, Fn, TerraformStack
95+
#
96+
# Provider bindings are generated by running `cdktf get`.
97+
# See https://cdk.tf/provider-generation for more details.
98+
#
99+
from imports.tfe.data_tfe_workspace import DataTfeWorkspace
100+
from imports.tfe.workspace_settings import WorkspaceSettings
101+
class MyConvertedCode(TerraformStack):
102+
def __init__(self, scope, name):
103+
super().__init__(scope, name)
104+
test = DataTfeWorkspace(self, "test",
105+
name="my-workspace-name",
106+
organization="my-org-name"
107+
)
108+
tfe_workspace_settings_test = WorkspaceSettings(self, "test_1",
109+
workspace_id=Token.as_string(test.id)
110+
)
111+
# This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.
112+
tfe_workspace_settings_test.override_logical_id("test")
113+
TerraformOutput(self, "workspace-explicit-local-execution",
114+
value=Fn.alltrue(
115+
Token.as_any([
116+
Op.eq(tfe_workspace_settings_test.execution_mode, "local"),
117+
Fn.lookup_nested(tfe_workspace_settings_test.overwrites, ["0", "\"execution_mode\""
118+
])
119+
]))
120+
)
121+
```
122+
123+
## Argument Reference
124+
125+
The following arguments are supported:
126+
127+
* `workspace_id` - (Required) ID of the workspace.
128+
* `agent_pool_id` - (Optional) The ID of an agent pool to assign to the workspace. Requires `execution_mode`
129+
to be set to `agent`. This value _must not_ be provided if `execution_mode` is set to any other value.
130+
* `execution_mode` - (Optional) Which [execution mode](https://developer.hashicorp.com/terraform/cloud-docs/workspaces/settings#execution-mode)
131+
to use. Using Terraform Cloud, valid values are `remote`, `local` or `agent`. Using Terraform Enterprise, only `remote` and `local` execution modes are valid. When set to `local`, the workspace will be used for state storage only. **Important:** If you omit this attribute, the resource configures the workspace to use your organization's default execution mode (which in turn defaults to `remote`), removing any explicit value that might have previously been set for the workspace.
132+
133+
## Attributes Reference
134+
135+
In addition to all arguments above, the following attributes are exported:
136+
137+
* `id` - The workspace ID.
138+
* `overwrites` - Can be used to check whether a setting is currently inheriting its value from another resource.
139+
- `execution_mode` - Set to `true` if the execution mode of the workspace is being determined by the setting on the workspace itself. It will be `false` if the execution mode is inherited from another resource (e.g. the organization's default execution mode)
140+
- `agent_pool` - Set to `true` if the agent pool of the workspace is being determined by the setting on the workspace itself. It will be `false` if the agent pool is inherited from another resource (e.g. the organization's default agent pool)
141+
142+
## Import
143+
144+
Workspaces can be imported; use `<WORKSPACE ID>` or `<ORGANIZATION NAME>/<WORKSPACE NAME>` as the
145+
import ID. For example:
146+
147+
```shell
148+
terraform import tfe_workspace_settings.test ws-CH5in3chf8RJjrVd
149+
```
150+
151+
```shell
152+
terraform import tfe_workspace_settings.test my-org-name/my-wkspace-name
153+
```
154+
155+
<!-- cache-key: cdktf-0.19.0 input-9b7213e3f3430e82b75a7c71909f07742b81d886b2bb9c0f527258ec71436d66 -->

website/docs/cdktf/typescript/r/workspace.html.markdown

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ description: |-
1111

1212
Provides a workspace resource.
1313

14+
~> **NOTE:** Setting the execution mode and agent pool affinity directly on the workspace is deprecated in favor of using both [tfe_workspace_settings](workspace_settings) and [tfe_organization_default_settings](organization_default_settings), since they allow more precise control and fully support [agent_pool_allowed_workspaces](agent_pool_allowed_workspaces). Use caution when unsetting `executionMode`, as it now leaves any prior value unmanaged instead of reverting to the old default value of `"remote"`.
15+
1416
~> **NOTE:** Using `globalRemoteState` or `remoteStateConsumerIds` requires using the provider with Terraform Cloud or an instance of Terraform Enterprise at least as recent as v202104-1.
1517

1618
## Example Usage
@@ -44,7 +46,7 @@ class MyConvertedCode extends TerraformStack {
4446

4547
```
4648

47-
With `executionMode` of `agent`:
49+
Usage with vcs_repo:
4850

4951
```typescript
5052
// DO NOT EDIT. Code generated by 'cdktf convert' - Please report bugs at https://cdk.tf/bug
@@ -54,7 +56,7 @@ import { TerraformStack } from "cdktf";
5456
* Provider bindings are generated by running `cdktf get`.
5557
* See https://cdk.tf/provider-generation for more details.
5658
*/
57-
import { AgentPool } from "./.gen/providers/tfe/agent-pool";
59+
import { OauthClient } from "./.gen/providers/tfe/oauth-client";
5860
import { Organization } from "./.gen/providers/tfe/organization";
5961
import { Workspace } from "./.gen/providers/tfe/workspace";
6062
class MyConvertedCode extends TerraformStack {
@@ -64,15 +66,22 @@ class MyConvertedCode extends TerraformStack {
6466
6567
name: "my-org-name",
6668
});
67-
const testAgentPool = new AgentPool(this, "test-agent-pool", {
68-
name: "my-agent-pool-name",
69-
organization: testOrganization.name,
69+
const test = new OauthClient(this, "test", {
70+
apiUrl: "https://api.github.com",
71+
httpUrl: "https://github.com",
72+
oauthToken: "oauth_token_id",
73+
organization: testOrganization,
74+
serviceProvider: "github",
7075
});
71-
new Workspace(this, "test", {
72-
agentPoolId: testAgentPool.id,
73-
executionMode: "agent",
74-
name: "my-workspace-name",
75-
organization: testOrganization.name,
76+
new Workspace(this, "parent", {
77+
name: "parent-ws",
78+
organization: testOrganization,
79+
queueAllRuns: false,
80+
vcsRepo: {
81+
branch: "main",
82+
identifier: "my-org-name/vcs-repository",
83+
oauthTokenId: test.oauthTokenId,
84+
},
7685
});
7786
}
7887
}
@@ -84,20 +93,13 @@ class MyConvertedCode extends TerraformStack {
8493
The following arguments are supported:
8594

8695
* `name` - (Required) Name of the workspace.
87-
* `agentPoolId` - (Optional) The ID of an agent pool to assign to the workspace. Requires `execution_mode`
88-
to be set to `agent`. This value _must not_ be provided if `execution_mode` is set to any other value or if `operations` is
89-
provided.
96+
* `agentPoolId` - (Optional) **Deprecated** The ID of an agent pool to assign to the workspace. Use [tfe_workspace_settings](workspace_settings) instead.
9097
* `allowDestroyPlan` - (Optional) Whether destroy plans can be queued on the workspace.
9198
* `assessmentsEnabled` - (Optional) Whether to regularly run health assessments such as drift detection on the workspace. Defaults to `false`.
9299
* `autoApply` - (Optional) Whether to automatically apply changes when a Terraform plan is successful. Defaults to `false`.
93100
* `autoApplyRunTrigger` - (Optional) Whether to automatically apply changes for runs that were created by run triggers from another workspace. Defaults to `false`.
94101
* `description` - (Optional) A description for the workspace.
95-
* `executionMode` - (Optional) Which [execution mode](https://developer.hashicorp.com/terraform/cloud-docs/workspaces/settings#execution-mode)
96-
to use. Using Terraform Cloud, valid values are `remote`, `local` or `agent`.
97-
Defaults your organization's default execution mode, or `remote` if no organization default is set. Using Terraform Enterprise, only `remote` and `local`
98-
execution modes are valid. When set to `local`, the workspace will be used
99-
for state storage only. This value _must not_ be provided if `operations`
100-
is provided.
102+
* `executionMode` - (Optional) **Deprecated** Which [execution mode](https://developer.hashicorp.com/terraform/cloud-docs/workspaces/settings#execution-mode) to use. Use [tfe_workspace_settings](workspace_settings) instead.
101103
* `fileTriggersEnabled` - (Optional) Whether to filter runs based on the changed files
102104
in a VCS push. Defaults to `true`. If enabled, the working directory and
103105
trigger prefixes describe a set of paths which must contain changes for a
@@ -176,9 +178,6 @@ In addition to all arguments above, the following attributes are exported:
176178
* `id` - The workspace ID.
177179
* `resourceCount` - The number of resources managed by the workspace.
178180
* `htmlUrl` - The URL to the browsable HTML overview of the workspace.
179-
* `settingOverwrites` - Can be used to check whether a setting is currently inheriting its value from another resource.
180-
- `execution_mode` - Set to `true` if the execution mode of the workspace is being determined by the setting on the workspace itself. It will be `false` if the execution mode is inherited from another resource (e.g. the organization's default execution mode)
181-
- `agent_pool` - Set to `true` if the agent pool of the workspace is being determined by the setting on the workspace itself. It will be `false` if the agent pool is inherited from another resource (e.g. the organization's default agent pool)
182181

183182
## Import
184183

@@ -193,4 +192,4 @@ terraform import tfe_workspace.test ws-CH5in3chf8RJjrVd
193192
terraform import tfe_workspace.test my-org-name/my-wkspace-name
194193
```
195194

196-
<!-- cache-key: cdktf-0.19.0 input-25e2316b67d698d4aec45557feedf54b6a8dfa43a6381d9c433cf7afabed73c9 -->
195+
<!-- cache-key: cdktf-0.19.0 input-1e1393c305fc1bc0e20e87ba524816e7ea2945e6904ebc7678f9fdab56db339f -->

0 commit comments

Comments
 (0)