Skip to content

Commit 32354dc

Browse files
authored
Merge pull request #1188 from hashicorp/d-cdktf-docs-7272926595-52
cdktf: update documentation
2 parents 3f4ed7f + f7d2a8f commit 32354dc

8 files changed

+517
-50
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ In addition to all arguments above, the following attributes are exported:
7373
* `trigger_patterns` - List of [glob patterns](https://developer.hashicorp.com/terraform/cloud-docs/workspaces/settings/vcs#glob-patterns-for-automatic-run-triggering) that describe the files Terraform Cloud monitors for changes. Trigger patterns are always appended to the root directory of the repository.
7474
* `vcs_repo` - Settings for the workspace's VCS repository.
7575
* `working_directory` - A relative path that Terraform will execute within.
76-
* `execution_mode` - Indicates the [execution mode](https://developer.hashicorp.com/terraform/cloud-docs/workspaces/settings#execution-mode) of the workspace. Possible values include `remote`, `local`, or `agent`.
76+
* `execution_mode` - Indicates the [execution mode](https://developer.hashicorp.com/terraform/cloud-docs/workspaces/settings#execution-mode) of the workspace. **Note:** This value might be derived from an organization-level default or set on the workspace itself; see the [`tfe_workspace_settings` resource](tfe_workspace_settings) for details.
7777
* `html_url` - The URL to the browsable HTML overview of the workspace
7878

7979

@@ -88,4 +88,4 @@ The `vcs_repo` block contains:
8888
* `oauth_token_id` - OAuth token ID of the configured VCS connection.
8989
* `tags_regex` - A regular expression used to trigger a Workspace run for matching Git tags.
9090

91-
<!-- cache-key: cdktf-0.19.0 input-82f43ee78054a4a88c04b2768dd5c3b6ba74cdac1de55fecef133b85fe5aee8a -->
91+
<!-- cache-key: cdktf-0.19.0 input-8a792abd68f0096121aefa7f2c56aa2455a7b698bf2cb5574b25e73321236d1e -->
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
layout: "tfe"
3+
page_title: "Terraform Enterprise: tfe_organization_default_settings
4+
description: |-
5+
Sets the workspace defaults for an organization
6+
---
7+
8+
9+
<!-- Please do not edit this file, it is generated. -->
10+
# tfe_organization_default_settings
11+
12+
Primarily, this is used to set the default execution mode of an organization. Settings configured here will be used as the default for all workspaces in the organization, unless they specify their own values with a [`tfe_workspace_settings` resource](workspace_settings.html) (or deprecated attributes on the workspace resource).
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.agent_pool import AgentPool
27+
from imports.tfe.organization import Organization
28+
from imports.tfe.organization_default_settings import OrganizationDefaultSettings
29+
from imports.tfe.workspace import Workspace
30+
class MyConvertedCode(TerraformStack):
31+
def __init__(self, scope, name):
32+
super().__init__(scope, name)
33+
test = Organization(self, "test",
34+
35+
name="my-org-name"
36+
)
37+
my_agents = AgentPool(self, "my_agents",
38+
name="agent_smiths",
39+
organization=test.name
40+
)
41+
org_default = OrganizationDefaultSettings(self, "org_default",
42+
default_agent_pool_id=my_agents.id,
43+
default_execution_mode="agent",
44+
organization=test.name
45+
)
46+
Workspace(self, "my_workspace",
47+
depends_on=[org_default],
48+
name="my-workspace"
49+
)
50+
```
51+
52+
## Argument Reference
53+
54+
The following arguments are supported:
55+
56+
* `default_execution_mode` - (Optional) Which [execution mode](https://developer.hashicorp.com/terraform/cloud-docs/workspaces/settings#execution-mode)
57+
to use as the default for all workspaces in the organization. Valid values are `remote`, `local` or`agent`.
58+
* `default_agent_pool_id` - (Optional) The ID of an agent pool to assign to the workspace. Requires `default_execution_mode` to be set to `agent`. This value _must not_ be provided if `default_execution_mode` is set to any other value.
59+
* `organization` - (Optional) Name of the organization. If omitted, organization must be defined in the provider config.
60+
61+
62+
## Import
63+
64+
Organization default execution mode can be imported; use `<ORGANIZATION NAME>` as the import ID. For example:
65+
66+
```shell
67+
terraform import tfe_organization_default_execution_mode.test my-org-name
68+
```
69+
70+
<!-- cache-key: cdktf-0.19.0 input-131403d8bfaba1dae78b9751415a0563f3f8e7f7bc52ca8bb1517c4637beb7bb -->

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/d/workspace.html.markdown

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ In addition to all arguments above, the following attributes are exported:
7676
* `triggerPatterns` - List of [glob patterns](https://developer.hashicorp.com/terraform/cloud-docs/workspaces/settings/vcs#glob-patterns-for-automatic-run-triggering) that describe the files Terraform Cloud monitors for changes. Trigger patterns are always appended to the root directory of the repository.
7777
* `vcsRepo` - Settings for the workspace's VCS repository.
7878
* `workingDirectory` - A relative path that Terraform will execute within.
79-
* `executionMode` - Indicates the [execution mode](https://developer.hashicorp.com/terraform/cloud-docs/workspaces/settings#execution-mode) of the workspace. Possible values include `remote`, `local`, or `agent`.
79+
* `executionMode` - Indicates the [execution mode](https://developer.hashicorp.com/terraform/cloud-docs/workspaces/settings#execution-mode) of the workspace. **Note:** This value might be derived from an organization-level default or set on the workspace itself; see the [`tfe_workspace_settings` resource](tfe_workspace_settings) for details.
8080
* `htmlUrl` - The URL to the browsable HTML overview of the workspace
8181

8282

@@ -91,4 +91,4 @@ The `vcsRepo` block contains:
9191
* `oauthTokenId` - OAuth token ID of the configured VCS connection.
9292
* `tagsRegex` - A regular expression used to trigger a Workspace run for matching Git tags.
9393

94-
<!-- cache-key: cdktf-0.19.0 input-82f43ee78054a4a88c04b2768dd5c3b6ba74cdac1de55fecef133b85fe5aee8a -->
94+
<!-- cache-key: cdktf-0.19.0 input-8a792abd68f0096121aefa7f2c56aa2455a7b698bf2cb5574b25e73321236d1e -->

0 commit comments

Comments
 (0)