From 3d4ff896376846d7c8b0d8b042908d953de6e28f Mon Sep 17 00:00:00 2001 From: sebasslash <7086531+sebasslash@users.noreply.github.com> Date: Thu, 19 Dec 2024 22:02:09 +0000 Subject: [PATCH] cdktf: update documentation --- .../cdktf/csharp/d/variable_set.html.markdown | 3 +- website/docs/cdktf/csharp/index.html.markdown | 8 +- .../csharp/r/audit_trail_token.html.markdown | 78 +++++++++++++ .../r/project_variable_set.html.markdown | 10 +- .../cdktf/csharp/r/variable_set.html.markdown | 93 ++++++++++++++- .../cdktf/csharp/r/workspace.html.markdown | 8 +- .../csharp/r/workspace_settings.markdown | 40 ++++++- .../r/workspace_variable_set.html.markdown | 4 +- .../cdktf/go/d/variable_set.html.markdown | 3 +- website/docs/cdktf/go/index.html.markdown | 8 +- .../go/r/audit_trail_token.html.markdown | 81 +++++++++++++ .../go/r/project_variable_set.html.markdown | 10 +- .../cdktf/go/r/variable_set.html.markdown | 106 +++++++++++++++++- .../docs/cdktf/go/r/workspace.html.markdown | 8 +- .../cdktf/go/r/workspace_settings.markdown | 59 +++++++++- .../go/r/workspace_variable_set.html.markdown | 12 +- .../cdktf/java/d/variable_set.html.markdown | 3 +- website/docs/cdktf/java/index.html.markdown | 8 +- .../java/r/audit_trail_token.html.markdown | 77 +++++++++++++ .../java/r/project_variable_set.html.markdown | 10 +- .../cdktf/java/r/variable_set.html.markdown | 98 +++++++++++++++- .../docs/cdktf/java/r/workspace.html.markdown | 8 +- .../cdktf/java/r/workspace_settings.markdown | 40 ++++++- .../r/workspace_variable_set.html.markdown | 4 +- .../cdktf/python/d/variable_set.html.markdown | 3 +- website/docs/cdktf/python/index.html.markdown | 8 +- .../python/r/audit_trail_token.html.markdown | 75 +++++++++++++ .../r/project_variable_set.html.markdown | 8 +- .../cdktf/python/r/variable_set.html.markdown | 87 +++++++++++++- .../cdktf/python/r/workspace.html.markdown | 8 +- .../python/r/workspace_settings.markdown | 86 +++++++++++--- .../r/workspace_variable_set.html.markdown | 58 ++++++---- .../typescript/d/variable_set.html.markdown | 3 +- .../docs/cdktf/typescript/index.html.markdown | 8 +- .../r/audit_trail_token.html.markdown | 78 +++++++++++++ .../r/project_variable_set.html.markdown | 8 +- .../typescript/r/variable_set.html.markdown | 101 ++++++++++++++++- .../typescript/r/workspace.html.markdown | 8 +- .../typescript/r/workspace_settings.markdown | 67 ++++++++++- .../r/workspace_variable_set.html.markdown | 61 ++++++---- 40 files changed, 1307 insertions(+), 139 deletions(-) create mode 100644 website/docs/cdktf/csharp/r/audit_trail_token.html.markdown create mode 100644 website/docs/cdktf/go/r/audit_trail_token.html.markdown create mode 100644 website/docs/cdktf/java/r/audit_trail_token.html.markdown create mode 100644 website/docs/cdktf/python/r/audit_trail_token.html.markdown create mode 100644 website/docs/cdktf/typescript/r/audit_trail_token.html.markdown diff --git a/website/docs/cdktf/csharp/d/variable_set.html.markdown b/website/docs/cdktf/csharp/d/variable_set.html.markdown index 7ed5e75a4..e001eb775 100644 --- a/website/docs/cdktf/csharp/d/variable_set.html.markdown +++ b/website/docs/cdktf/csharp/d/variable_set.html.markdown @@ -51,5 +51,6 @@ The following arguments are supported: * `WorkspaceIds` - IDs of the workspaces that use the variable set. * `VariableIds` - IDs of the variables attached to the variable set. * `ProjectIds` - IDs of the projects that use the variable set. +* `ParentProjectId` - ID of the project that owns the variable set. - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/csharp/index.html.markdown b/website/docs/cdktf/csharp/index.html.markdown index c768751d3..d3da55dcb 100644 --- a/website/docs/cdktf/csharp/index.html.markdown +++ b/website/docs/cdktf/csharp/index.html.markdown @@ -77,7 +77,7 @@ automatically installed by `terraform init` in the future: terraform { required_providers { tfe = { - version = "~> 0.60.0" + version = "~> 0.62.0" } } } @@ -90,7 +90,7 @@ The above snippet using `RequiredProviders` is for Terraform 0.13+; if you are u ```hcl provider "tfe" { - version = "~> 0.60.0" + version = "~> 0.62.0" ... } ``` @@ -103,7 +103,7 @@ For more information on provider installation and constraining provider versions provider "tfe" { hostname = var.hostname # Optional, defaults to HCP Terraform `AppTerraformIo` token = var.token - version = "~> 0.60.0" + version = "~> 0.62.0" } # Create an organization @@ -129,4 +129,4 @@ The following arguments are supported: arguments. Ensure that the organization already exists prior to using this argument. This can also be specified using the `TfeOrganization` environment variable. - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/csharp/r/audit_trail_token.html.markdown b/website/docs/cdktf/csharp/r/audit_trail_token.html.markdown new file mode 100644 index 000000000..bac8c0bb2 --- /dev/null +++ b/website/docs/cdktf/csharp/r/audit_trail_token.html.markdown @@ -0,0 +1,78 @@ +--- +layout: "tfe" +page_title: "Terraform Enterprise: tfe_audit_trail_token" +description: |- + Generates a new audit trail token in organization, replacing any existing token. +--- + + + +# tfe_audit_trail_token + +Generates a new audit trail token in organization, replacing any existing token. + +Note that only organizations that have the [audit-logging entitlement](https://developer.hashicorp.com/terraform/cloud-docs/api-docs#audit-logging) may create audit trail tokens. + +## Example Usage + +Basic usage: + +```csharp +using Constructs; +using HashiCorp.Cdktf; +/*Provider bindings are generated by running cdktf get. +See https://cdk.tf/provider-generation for more details.*/ +using Gen.Providers.Tfe; +class MyConvertedCode : TerraformStack +{ + public MyConvertedCode(Construct scope, string name) : base(scope, name) + { + new AuditTrailToken.AuditTrailToken(this, "test", new AuditTrailTokenConfig { + Organization = "my-org-name" + }); + } +} +``` + +## Argument Reference + +The following arguments are supported: + +* `Organization` - (Optional) Name of the organization. If omitted, organization must be defined in the provider config. +* `ForceRegenerate` - (Optional) If set to `True`, a new token will be + generated even if a token already exists. This will invalidate the existing + token! +* `ExpiredAt` - (Optional) The token's expiration date. The expiration date must be a date/time string in RFC3339 +format (e.g., "2024-12-31T23:59:59Z"). If no expiration date is supplied, the expiration date will default to null and +never expire. + +## Example Usage + +When a token has an expiry: + +```hcl +resource "time_rotating" "example" { + rotation_days = 30 +} + +resource "tfe_audit_trail_token" "test" { + organization = data.tfe_organization.org.name + expired_at = time_rotating.example.rotation_rfc3339 +} +``` + +## Attributes Reference + +* `Id` - The ID of the token. +* `Token` - The generated token. + +## Import + +Audit trail tokens can be imported; use `` as the import ID. +For example: + +```shell +terraform import tfe_audit_trail_token.test my-org-name +``` + + \ No newline at end of file diff --git a/website/docs/cdktf/csharp/r/project_variable_set.html.markdown b/website/docs/cdktf/csharp/r/project_variable_set.html.markdown index c10a59e3a..9416d1099 100644 --- a/website/docs/cdktf/csharp/r/project_variable_set.html.markdown +++ b/website/docs/cdktf/csharp/r/project_variable_set.html.markdown @@ -5,9 +5,15 @@ description: |- Add a variable set to a project --- + + # tfe_project_variable_set -Adds and removes variable sets from a project +Adds and removes a project from a variable set's scope. + +-> **Note:** This resource controls whether a project has access to a variable set, not whether +a project owns the variable set. Ownership is specified by setting the `ParentProjectId` on the +`TfeVariableSet` resource. ## Example Usage @@ -70,4 +76,4 @@ Project Variable Sets can be imported; use `// \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/csharp/r/variable_set.html.markdown b/website/docs/cdktf/csharp/r/variable_set.html.markdown index 2be6d4b7e..63828fcbe 100644 --- a/website/docs/cdktf/csharp/r/variable_set.html.markdown +++ b/website/docs/cdktf/csharp/r/variable_set.html.markdown @@ -164,6 +164,95 @@ class MyConvertedCode : TerraformStack } ``` +Creating a project-owned variable set that is applied to all workspaces in the project: + +```csharp +using Constructs; +using HashiCorp.Cdktf; +/*Provider bindings are generated by running cdktf get. +See https://cdk.tf/provider-generation for more details.*/ +using Gen.Providers.Tfe; +class MyConvertedCode : TerraformStack +{ + public MyConvertedCode(Construct scope, string name) : base(scope, name) + { + var tfeOrganizationTest = new Organization.Organization(this, "test", new OrganizationConfig { + Email = "admin@company.com", + Name = "my-org-name" + }); + var tfeProjectTest = new Project.Project(this, "test_1", new ProjectConfig { + Name = "projectname", + Organization = Token.AsString(tfeOrganizationTest.Name) + }); + /*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/ + tfeProjectTest.OverrideLogicalId("test"); + var tfeVariableSetTest = new VariableSet.VariableSet(this, "test_2", new VariableSetConfig { + Description = "Varset that is owned and managed by a project.", + Name = "Project-owned Varset", + Organization = Token.AsString(tfeOrganizationTest.Name), + ParentProjectId = Token.AsString(tfeProjectTest.Id) + }); + /*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/ + tfeVariableSetTest.OverrideLogicalId("test"); + var tfeProjectVariableSetTest = + new ProjectVariableSet.ProjectVariableSet(this, "test_3", new ProjectVariableSetConfig { + ProjectId = Token.AsString(tfeProjectTest.Id), + VariableSetId = Token.AsString(tfeVariableSetTest.Id) + }); + /*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/ + tfeProjectVariableSetTest.OverrideLogicalId("test"); + } +} +``` + +Creating a project-owned variable set that is applied to specific workspaces: + +```csharp +using Constructs; +using HashiCorp.Cdktf; +/*Provider bindings are generated by running cdktf get. +See https://cdk.tf/provider-generation for more details.*/ +using Gen.Providers.Tfe; +class MyConvertedCode : TerraformStack +{ + public MyConvertedCode(Construct scope, string name) : base(scope, name) + { + var tfeOrganizationTest = new Organization.Organization(this, "test", new OrganizationConfig { + Email = "admin@company.com", + Name = "my-org-name" + }); + var tfeProjectTest = new Project.Project(this, "test_1", new ProjectConfig { + Name = "projectname", + Organization = Token.AsString(tfeOrganizationTest.Name) + }); + /*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/ + tfeProjectTest.OverrideLogicalId("test"); + var tfeVariableSetTest = new VariableSet.VariableSet(this, "test_2", new VariableSetConfig { + Description = "Varset that is owned and managed by a project.", + Name = "Project-owned Varset", + Organization = Token.AsString(tfeOrganizationTest.Name), + ParentProjectId = Token.AsString(tfeProjectTest.Id) + }); + /*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/ + tfeVariableSetTest.OverrideLogicalId("test"); + var tfeWorkspaceTest = new Workspace.Workspace(this, "test_3", new WorkspaceConfig { + Name = "my-workspace-name", + Organization = Token.AsString(tfeOrganizationTest.Name), + ProjectId = Token.AsString(tfeProjectTest.Id) + }); + /*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/ + tfeWorkspaceTest.OverrideLogicalId("test"); + var tfeWorkspaceVariableSetTest = + new WorkspaceVariableSet.WorkspaceVariableSet(this, "test_4", new WorkspaceVariableSetConfig { + VariableSetId = Token.AsString(tfeVariableSetTest.Id), + WorkspaceId = Token.AsString(tfeWorkspaceTest.Id) + }); + /*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/ + tfeWorkspaceVariableSetTest.OverrideLogicalId("test"); + } +} +``` + ## Argument Reference The following arguments are supported: @@ -177,6 +266,8 @@ The following arguments are supported: Must not be set if `Global` is set. This argument is mutually exclusive with using the resource [tfe_workspace_variable_set](workspace_variable_set.html) which is the preferred method of associating a workspace with a variable set. +* `ParentProjectId` - (Optional) ID of the project that should own the variable set. If set, than the value of `Global` must be `False`. + To assign whether a variable set should be applied to a project, use the [`TfeProjectVariableSet`](project_variable_set.html) resource. ## Attributes Reference @@ -190,4 +281,4 @@ Variable sets can be imported; use `` as the import ID. For exa terraform import tfe_variable_set.test varset-5rTwnSaRPogw6apb ``` - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/csharp/r/workspace.html.markdown b/website/docs/cdktf/csharp/r/workspace.html.markdown index 391705e04..ab6b032b5 100644 --- a/website/docs/cdktf/csharp/r/workspace.html.markdown +++ b/website/docs/cdktf/csharp/r/workspace.html.markdown @@ -13,8 +13,6 @@ Provides a workspace resource. ~> **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"`. -~> **NOTE:** Using `GlobalRemoteState` or `RemoteStateConsumerIds` requires using the provider with HCP Terraform or an instance of Terraform Enterprise at least as recent as v202104-1. - ## Example Usage Basic usage: @@ -101,7 +99,7 @@ The following arguments are supported: trigger prefixes describe a set of paths which must contain changes for a VCS push to trigger a run. If disabled, any push will trigger a run. * `ForceDelete` - (Optional) If this attribute is present on a workspace that is being deleted through the provider, it will use the existing force delete API. If this attribute is not present or false it will safe delete the workspace. -* `GlobalRemoteState` - (Optional) Whether the workspace allows all workspaces in the organization to access its state data during runs. If false, then only specifically approved workspaces can access its state (`RemoteStateConsumerIds`). +* `GlobalRemoteState` - (Optional) **Deprecated** Whether the workspace allows all workspaces in the organization to access its state data during runs. Use [tfe_workspace_settings](workspace_settings) instead. * `Operations` - **Deprecated** Whether to use remote execution mode. Defaults to `True`. When set to `False`, the workspace will be used for state storage only. This value _must not_ be provided if `ExecutionMode` is @@ -116,7 +114,7 @@ The following arguments are supported: is `False`. The provider uses `True` as any workspace provisioned with `False` would need to then have a run manually queued out-of-band before accepting webhooks. -* `RemoteStateConsumerIds` - (Optional) The set of workspace IDs set as explicit remote state consumers for the given workspace. +* `RemoteStateConsumerIds` - (Optional) **Deprecated** The set of workspace IDs set as explicit remote state consumers for the given workspace. Use [tfe_workspace_settings](workspace_settings) instead. * `SourceName` - (Optional) A friendly name for the application or client creating this workspace. If set, this will be displayed on the workspace as "Created via ". @@ -193,4 +191,4 @@ terraform import tfe_workspace.test ws-CH5in3chf8RJjrVd terraform import tfe_workspace.test my-org-name/my-wkspace-name ``` - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/csharp/r/workspace_settings.markdown b/website/docs/cdktf/csharp/r/workspace_settings.markdown index 4f9bb5847..8c423df46 100644 --- a/website/docs/cdktf/csharp/r/workspace_settings.markdown +++ b/website/docs/cdktf/csharp/r/workspace_settings.markdown @@ -81,6 +81,42 @@ class MyConvertedCode : TerraformStack } ``` +Using `RemoteStateConsumerIds`: + +```csharp +using Constructs; +using HashiCorp.Cdktf; +/*Provider bindings are generated by running cdktf get. +See https://cdk.tf/provider-generation for more details.*/ +using Gen.Providers.Tfe; +class MyConvertedCode : TerraformStack +{ + public MyConvertedCode(Construct scope, string name) : base(scope, name) + { + /*In most cases loops should be handled in the programming language context and + not inside of the Terraform context. If you are looping over something external, e.g. a variable or a file input + you should consider using a for loop. If you are looping over something only known to Terraform, e.g. a result of a data source + you need to keep this like it is.*/ + var tfeWorkspaceTestForEachIterator = TerraformIterator.FromList(Token.AsAny(Fn.Toset(new [] { "qa", "production" }))); + var tfeWorkspaceTest = new Workspace.Workspace(this, "test", new WorkspaceConfig { + Name = "${" + tfeWorkspaceTestForEachIterator.Value + "}-test", + ForEach = tfeWorkspaceTestForEachIterator + }); + /*In most cases loops should be handled in the programming language context and + not inside of the Terraform context. If you are looping over something external, e.g. a variable or a file input + you should consider using a for loop. If you are looping over something only known to Terraform, e.g. a result of a data source + you need to keep this like it is.*/ + var tfeWorkspaceSettingsTestSettingsForEachIterator = TerraformIterator.FromList(Token.AsAny(Fn.Toset(new [] { "qa", "production" }))); + new WorkspaceSettings.WorkspaceSettings(this, "test-settings", new WorkspaceSettingsConfig { + GlobalRemoteState = false, + RemoteStateConsumerIds = Token.AsList(Fn.Toset(Fn.Compact(Token.AsList(new [] { Conditional(Op.Eq(tfeWorkspaceSettingsTestSettingsForEachIterator.Value, "production"), PropertyAccess(tfeWorkspaceTest, new [] { "\"qa\"", "id" }), "") })))), + WorkspaceId = Token.AsString(PropertyAccess(PropertyAccess(tfeWorkspaceTest, new [] { tfeWorkspaceSettingsTestSettingsForEachIterator.Value }), new [] { "id" })), + ForEach = tfeWorkspaceSettingsTestSettingsForEachIterator + }); + } +} +``` + This resource may be used as a data source when no optional arguments are defined: ```csharp @@ -119,6 +155,8 @@ The following arguments are supported: to be set to `Agent`. This value _must not_ be provided if `ExecutionMode` is set to any other value. * `ExecutionMode` - (Optional) Which [execution mode](https://developer.hashicorp.com/terraform/cloud-docs/workspaces/settings#execution-mode) to use. Using HCP Terraform, valid values are `Remote`, `Local` or `Agent`. 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. +* `GlobalRemoteState` - (Optional) Whether the workspace allows all workspaces in the organization to access its state data during runs. If false, then only specifically approved workspaces can access its state (`RemoteStateConsumerIds`). By default, HashiCorp recommends you do not allow other workspaces to access their state. We recommend that you follow the principle of least privilege and only enable state access between workspaces that specifically need information from each other. +* `RemoteStateConsumerIds` - (Optional) The set of workspace IDs set as explicit remote state consumers for the given workspace. To set this attribute, global_remote_state must be false. ## Attributes Reference @@ -142,4 +180,4 @@ terraform import tfe_workspace_settings.test ws-CH5in3chf8RJjrVd terraform import tfe_workspace_settings.test my-org-name/my-wkspace-name ``` - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/csharp/r/workspace_variable_set.html.markdown b/website/docs/cdktf/csharp/r/workspace_variable_set.html.markdown index 8e282e2b7..64bd81a6d 100644 --- a/website/docs/cdktf/csharp/r/workspace_variable_set.html.markdown +++ b/website/docs/cdktf/csharp/r/workspace_variable_set.html.markdown @@ -9,7 +9,7 @@ description: |- # tfe_workspace_variable_set -Adds and removes variable sets from a workspace +Adds and removes a workspace from a variable set's scope. -> **Note:** `TfeVariableSet` has a deprecated argument `WorkspaceIds` that should not be used alongside this resource. They attempt to manage the same attachments and are mutually exclusive. @@ -74,4 +74,4 @@ Workspace Variable Sets can be imported; use `// \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/go/d/variable_set.html.markdown b/website/docs/cdktf/go/d/variable_set.html.markdown index e91e7e99e..70a47ab4b 100644 --- a/website/docs/cdktf/go/d/variable_set.html.markdown +++ b/website/docs/cdktf/go/d/variable_set.html.markdown @@ -54,5 +54,6 @@ The following arguments are supported: * `WorkspaceIds` - IDs of the workspaces that use the variable set. * `VariableIds` - IDs of the variables attached to the variable set. * `ProjectIds` - IDs of the projects that use the variable set. +* `ParentProjectId` - ID of the project that owns the variable set. - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/go/index.html.markdown b/website/docs/cdktf/go/index.html.markdown index c768751d3..d3da55dcb 100644 --- a/website/docs/cdktf/go/index.html.markdown +++ b/website/docs/cdktf/go/index.html.markdown @@ -77,7 +77,7 @@ automatically installed by `terraform init` in the future: terraform { required_providers { tfe = { - version = "~> 0.60.0" + version = "~> 0.62.0" } } } @@ -90,7 +90,7 @@ The above snippet using `RequiredProviders` is for Terraform 0.13+; if you are u ```hcl provider "tfe" { - version = "~> 0.60.0" + version = "~> 0.62.0" ... } ``` @@ -103,7 +103,7 @@ For more information on provider installation and constraining provider versions provider "tfe" { hostname = var.hostname # Optional, defaults to HCP Terraform `AppTerraformIo` token = var.token - version = "~> 0.60.0" + version = "~> 0.62.0" } # Create an organization @@ -129,4 +129,4 @@ The following arguments are supported: arguments. Ensure that the organization already exists prior to using this argument. This can also be specified using the `TfeOrganization` environment variable. - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/go/r/audit_trail_token.html.markdown b/website/docs/cdktf/go/r/audit_trail_token.html.markdown new file mode 100644 index 000000000..1f5c1ee99 --- /dev/null +++ b/website/docs/cdktf/go/r/audit_trail_token.html.markdown @@ -0,0 +1,81 @@ +--- +layout: "tfe" +page_title: "Terraform Enterprise: tfe_audit_trail_token" +description: |- + Generates a new audit trail token in organization, replacing any existing token. +--- + + + +# tfe_audit_trail_token + +Generates a new audit trail token in organization, replacing any existing token. + +Note that only organizations that have the [audit-logging entitlement](https://developer.hashicorp.com/terraform/cloud-docs/api-docs#audit-logging) may create audit trail tokens. + +## Example Usage + +Basic usage: + +```go +import constructs "github.com/aws/constructs-go/constructs" +import cdktf "github.com/hashicorp/terraform-cdk-go/cdktf" +/*Provider bindings are generated by running cdktf get. +See https://cdk.tf/provider-generation for more details.*/ +import "github.com/aws-samples/dummy/gen/providers/tfe/auditTrailToken" +type myConvertedCode struct { + terraformStack +} + +func newMyConvertedCode(scope construct, name *string) *myConvertedCode { + this := &myConvertedCode{} + cdktf.NewTerraformStack_Override(this, scope, name) + auditTrailToken.NewAuditTrailToken(this, jsii.String("test"), &auditTrailTokenConfig{ + organization: jsii.String("my-org-name"), + }) + return this +} +``` + +## Argument Reference + +The following arguments are supported: + +* `Organization` - (Optional) Name of the organization. If omitted, organization must be defined in the provider config. +* `ForceRegenerate` - (Optional) If set to `True`, a new token will be + generated even if a token already exists. This will invalidate the existing + token! +* `ExpiredAt` - (Optional) The token's expiration date. The expiration date must be a date/time string in RFC3339 +format (e.g., "2024-12-31T23:59:59Z"). If no expiration date is supplied, the expiration date will default to null and +never expire. + +## Example Usage + +When a token has an expiry: + +```hcl +resource "time_rotating" "example" { + rotation_days = 30 +} + +resource "tfe_audit_trail_token" "test" { + organization = data.tfe_organization.org.name + expired_at = time_rotating.example.rotation_rfc3339 +} +``` + +## Attributes Reference + +* `Id` - The ID of the token. +* `Token` - The generated token. + +## Import + +Audit trail tokens can be imported; use `` as the import ID. +For example: + +```shell +terraform import tfe_audit_trail_token.test my-org-name +``` + + \ No newline at end of file diff --git a/website/docs/cdktf/go/r/project_variable_set.html.markdown b/website/docs/cdktf/go/r/project_variable_set.html.markdown index 465f517be..365f352ed 100644 --- a/website/docs/cdktf/go/r/project_variable_set.html.markdown +++ b/website/docs/cdktf/go/r/project_variable_set.html.markdown @@ -5,9 +5,15 @@ description: |- Add a variable set to a project --- + + # tfe_project_variable_set -Adds and removes variable sets from a project +Adds and removes a project from a variable set's scope. + +-> **Note:** This resource controls whether a project has access to a variable set, not whether +a project owns the variable set. Ownership is specified by setting the `ParentProjectId` on the +`TfeVariableSet` resource. ## Example Usage @@ -76,4 +82,4 @@ Project Variable Sets can be imported; use `// \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/go/r/variable_set.html.markdown b/website/docs/cdktf/go/r/variable_set.html.markdown index 7b71f0dbb..caf0b22d3 100644 --- a/website/docs/cdktf/go/r/variable_set.html.markdown +++ b/website/docs/cdktf/go/r/variable_set.html.markdown @@ -183,6 +183,108 @@ func newMyConvertedCode(scope construct, name *string) *myConvertedCode { } ``` +Creating a project-owned variable set that is applied to all workspaces in the project: + +```go +import constructs "github.com/aws/constructs-go/constructs" +import "github.com/hashicorp/terraform-cdk-go/cdktf" +/*Provider bindings are generated by running cdktf get. +See https://cdk.tf/provider-generation for more details.*/ +import "github.com/aws-samples/dummy/gen/providers/tfe/organization" +import "github.com/aws-samples/dummy/gen/providers/tfe/project" +import "github.com/aws-samples/dummy/gen/providers/tfe/variableSet" +import "github.com/aws-samples/dummy/gen/providers/tfe/projectVariableSet" +type myConvertedCode struct { + terraformStack +} + +func newMyConvertedCode(scope construct, name *string) *myConvertedCode { + this := &myConvertedCode{} + cdktf.NewTerraformStack_Override(this, scope, name) + tfeOrganizationTest := organization.NewOrganization(this, jsii.String("test"), &organizationConfig{ + email: jsii.String("admin@company.com"), + name: jsii.String("my-org-name"), + }) + tfeProjectTest := project.NewProject(this, jsii.String("test_1"), &projectConfig{ + name: jsii.String("projectname"), + organization: cdktf.Token_AsString(tfeOrganizationTest.name), + }) + /*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/ + tfeProjectTest.OverrideLogicalId(jsii.String("test")) + tfeVariableSetTest := variableSet.NewVariableSet(this, jsii.String("test_2"), &variableSetConfig{ + description: jsii.String("Varset that is owned and managed by a project."), + name: jsii.String("Project-owned Varset"), + organization: cdktf.Token_*AsString(tfeOrganizationTest.name), + parentProjectId: cdktf.Token_*AsString(tfeProjectTest.id), + }) + /*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/ + tfeVariableSetTest.OverrideLogicalId(jsii.String("test")) + tfeProjectVariableSetTest := + projectVariableSet.NewProjectVariableSet(this, jsii.String("test_3"), &projectVariableSetConfig{ + projectId: cdktf.Token_*AsString(tfeProjectTest.id), + variableSetId: cdktf.Token_*AsString(tfeVariableSetTest.id), + }) + /*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/ + tfeProjectVariableSetTest.OverrideLogicalId(jsii.String("test")) + return this +} +``` + +Creating a project-owned variable set that is applied to specific workspaces: + +```go +import constructs "github.com/aws/constructs-go/constructs" +import "github.com/hashicorp/terraform-cdk-go/cdktf" +/*Provider bindings are generated by running cdktf get. +See https://cdk.tf/provider-generation for more details.*/ +import "github.com/aws-samples/dummy/gen/providers/tfe/organization" +import "github.com/aws-samples/dummy/gen/providers/tfe/project" +import "github.com/aws-samples/dummy/gen/providers/tfe/variableSet" +import "github.com/aws-samples/dummy/gen/providers/tfe/workspace" +import "github.com/aws-samples/dummy/gen/providers/tfe/workspaceVariableSet" +type myConvertedCode struct { + terraformStack +} + +func newMyConvertedCode(scope construct, name *string) *myConvertedCode { + this := &myConvertedCode{} + cdktf.NewTerraformStack_Override(this, scope, name) + tfeOrganizationTest := organization.NewOrganization(this, jsii.String("test"), &organizationConfig{ + email: jsii.String("admin@company.com"), + name: jsii.String("my-org-name"), + }) + tfeProjectTest := project.NewProject(this, jsii.String("test_1"), &projectConfig{ + name: jsii.String("projectname"), + organization: cdktf.Token_AsString(tfeOrganizationTest.name), + }) + /*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/ + tfeProjectTest.OverrideLogicalId(jsii.String("test")) + tfeVariableSetTest := variableSet.NewVariableSet(this, jsii.String("test_2"), &variableSetConfig{ + description: jsii.String("Varset that is owned and managed by a project."), + name: jsii.String("Project-owned Varset"), + organization: cdktf.Token_*AsString(tfeOrganizationTest.name), + parentProjectId: cdktf.Token_*AsString(tfeProjectTest.id), + }) + /*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/ + tfeVariableSetTest.OverrideLogicalId(jsii.String("test")) + tfeWorkspaceTest := workspace.NewWorkspace(this, jsii.String("test_3"), &workspaceConfig{ + name: jsii.String("my-workspace-name"), + organization: cdktf.Token_*AsString(tfeOrganizationTest.name), + projectId: cdktf.Token_*AsString(tfeProjectTest.id), + }) + /*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/ + tfeWorkspaceTest.OverrideLogicalId(jsii.String("test")) + tfeWorkspaceVariableSetTest := + workspaceVariableSet.NewWorkspaceVariableSet(this, jsii.String("test_4"), &workspaceVariableSetConfig{ + variableSetId: cdktf.Token_*AsString(tfeVariableSetTest.id), + workspaceId: cdktf.Token_*AsString(tfeWorkspaceTest.id), + }) + /*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/ + tfeWorkspaceVariableSetTest.OverrideLogicalId(jsii.String("test")) + return this +} +``` + ## Argument Reference The following arguments are supported: @@ -196,6 +298,8 @@ The following arguments are supported: Must not be set if `Global` is set. This argument is mutually exclusive with using the resource [tfe_workspace_variable_set](workspace_variable_set.html) which is the preferred method of associating a workspace with a variable set. +* `ParentProjectId` - (Optional) ID of the project that should own the variable set. If set, than the value of `Global` must be `False`. + To assign whether a variable set should be applied to a project, use the [`TfeProjectVariableSet`](project_variable_set.html) resource. ## Attributes Reference @@ -209,4 +313,4 @@ Variable sets can be imported; use `` as the import ID. For exa terraform import tfe_variable_set.test varset-5rTwnSaRPogw6apb ``` - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/go/r/workspace.html.markdown b/website/docs/cdktf/go/r/workspace.html.markdown index 91ab0c598..6d40d4467 100644 --- a/website/docs/cdktf/go/r/workspace.html.markdown +++ b/website/docs/cdktf/go/r/workspace.html.markdown @@ -13,8 +13,6 @@ Provides a workspace resource. ~> **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"`. -~> **NOTE:** Using `GlobalRemoteState` or `RemoteStateConsumerIds` requires using the provider with HCP Terraform or an instance of Terraform Enterprise at least as recent as v202104-1. - ## Example Usage Basic usage: @@ -113,7 +111,7 @@ The following arguments are supported: trigger prefixes describe a set of paths which must contain changes for a VCS push to trigger a run. If disabled, any push will trigger a run. * `ForceDelete` - (Optional) If this attribute is present on a workspace that is being deleted through the provider, it will use the existing force delete API. If this attribute is not present or false it will safe delete the workspace. -* `GlobalRemoteState` - (Optional) Whether the workspace allows all workspaces in the organization to access its state data during runs. If false, then only specifically approved workspaces can access its state (`RemoteStateConsumerIds`). +* `GlobalRemoteState` - (Optional) **Deprecated** Whether the workspace allows all workspaces in the organization to access its state data during runs. Use [tfe_workspace_settings](workspace_settings) instead. * `Operations` - **Deprecated** Whether to use remote execution mode. Defaults to `True`. When set to `False`, the workspace will be used for state storage only. This value _must not_ be provided if `ExecutionMode` is @@ -128,7 +126,7 @@ The following arguments are supported: is `False`. The provider uses `True` as any workspace provisioned with `False` would need to then have a run manually queued out-of-band before accepting webhooks. -* `RemoteStateConsumerIds` - (Optional) The set of workspace IDs set as explicit remote state consumers for the given workspace. +* `RemoteStateConsumerIds` - (Optional) **Deprecated** The set of workspace IDs set as explicit remote state consumers for the given workspace. Use [tfe_workspace_settings](workspace_settings) instead. * `SourceName` - (Optional) A friendly name for the application or client creating this workspace. If set, this will be displayed on the workspace as "Created via ". @@ -205,4 +203,4 @@ terraform import tfe_workspace.test ws-CH5in3chf8RJjrVd terraform import tfe_workspace.test my-org-name/my-wkspace-name ``` - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/go/r/workspace_settings.markdown b/website/docs/cdktf/go/r/workspace_settings.markdown index de2b5da63..7214b3009 100644 --- a/website/docs/cdktf/go/r/workspace_settings.markdown +++ b/website/docs/cdktf/go/r/workspace_settings.markdown @@ -95,6 +95,61 @@ func newMyConvertedCode(scope construct, name *string) *myConvertedCode { } ``` +Using `RemoteStateConsumerIds`: + +```go +import constructs "github.com/aws/constructs-go/constructs" +import "github.com/hashicorp/terraform-cdk-go/cdktf" +/*Provider bindings are generated by running cdktf get. +See https://cdk.tf/provider-generation for more details.*/ +import "github.com/aws-samples/dummy/gen/providers/tfe/workspace" +import "github.com/aws-samples/dummy/gen/providers/tfe/workspaceSettings" +type myConvertedCode struct { + terraformStack +} + +func newMyConvertedCode(scope construct, name *string) *myConvertedCode { + this := &myConvertedCode{} + cdktf.NewTerraformStack_Override(this, scope, name) + /*In most cases loops should be handled in the programming language context and + not inside of the Terraform context. If you are looping over something external, e.g. a variable or a file input + you should consider using a for loop. If you are looping over something only known to Terraform, e.g. a result of a data source + you need to keep this like it is.*/ + tfeWorkspaceTestForEachIterator := cdktf.TerraformIterator_FromList(cdktf.Token_AsAny(cdktf.Fn_Toset([]interface{}{ + jsii.String("qa"), + jsii.String("production"), + }))) + tfeWorkspaceTest := workspace.NewWorkspace(this, jsii.String("test"), &workspaceConfig{ + name: jsii.String("${" + tfeWorkspaceTestForEachIterator.value + "}-test"), + forEach: tfeWorkspaceTestForEachIterator, + }) + /*In most cases loops should be handled in the programming language context and + not inside of the Terraform context. If you are looping over something external, e.g. a variable or a file input + you should consider using a for loop. If you are looping over something only known to Terraform, e.g. a result of a data source + you need to keep this like it is.*/ + tfeWorkspaceSettingsTestSettingsForEachIterator := cdktf.TerraformIterator_FromList(cdktf.Token_AsAny(cdktf.Fn_Toset([]interface{}{ + jsii.String("qa"), + jsii.String("production"), + }))) + workspaceSettings.NewWorkspaceSettings(this, jsii.String("test-settings"), &workspaceSettingsConfig{ + globalRemoteState: jsii.Boolean(false), + remoteStateConsumerIds: cdktf.Token_AsList(cdktf.Fn_*Toset(cdktf.Fn_Compact(cdktf.Token_*AsList([]interface{}{ + cdktf.conditional(cdktf.Op_Eq(tfeWorkspaceSettingsTestSettingsForEachIterator.value, jsii.String("production")), cdktf.propertyAccess(tfeWorkspaceTest, []interface{}{ + jsii.String("\"qa\""), + jsii.String("id"), + }), jsii.String("")), + })))), + workspaceId: cdktf.Token_AsString(cdktf.propertyAccess(cdktf.propertyAccess(tfeWorkspaceTest, []interface{}{ + tfeWorkspaceSettingsTestSettingsForEachIterator.value, + }), []interface{}{ + jsii.String("id"), + })), + forEach: tfeWorkspaceSettingsTestSettingsForEachIterator, + }) + return this +} +``` + This resource may be used as a data source when no optional arguments are defined: ```go @@ -143,6 +198,8 @@ The following arguments are supported: to be set to `Agent`. This value _must not_ be provided if `ExecutionMode` is set to any other value. * `ExecutionMode` - (Optional) Which [execution mode](https://developer.hashicorp.com/terraform/cloud-docs/workspaces/settings#execution-mode) to use. Using HCP Terraform, valid values are `Remote`, `Local` or `Agent`. 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. +* `GlobalRemoteState` - (Optional) Whether the workspace allows all workspaces in the organization to access its state data during runs. If false, then only specifically approved workspaces can access its state (`RemoteStateConsumerIds`). By default, HashiCorp recommends you do not allow other workspaces to access their state. We recommend that you follow the principle of least privilege and only enable state access between workspaces that specifically need information from each other. +* `RemoteStateConsumerIds` - (Optional) The set of workspace IDs set as explicit remote state consumers for the given workspace. To set this attribute, global_remote_state must be false. ## Attributes Reference @@ -166,4 +223,4 @@ terraform import tfe_workspace_settings.test ws-CH5in3chf8RJjrVd terraform import tfe_workspace_settings.test my-org-name/my-wkspace-name ``` - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/go/r/workspace_variable_set.html.markdown b/website/docs/cdktf/go/r/workspace_variable_set.html.markdown index 49fed4ec8..cf02f0eec 100644 --- a/website/docs/cdktf/go/r/workspace_variable_set.html.markdown +++ b/website/docs/cdktf/go/r/workspace_variable_set.html.markdown @@ -9,7 +9,7 @@ description: |- # tfe_workspace_variable_set -Adds and removes variable sets from a workspace +Adds and removes a workspace from a variable set's scope. -> **Note:** `TfeVariableSet` has a deprecated argument `WorkspaceIds` that should not be used alongside this resource. They attempt to manage the same attachments and are mutually exclusive. @@ -40,20 +40,20 @@ func newMyConvertedCode(scope construct, name *string) *myConvertedCode { tfeVariableSetTest := variableSet.NewVariableSet(this, jsii.String("test_1"), &variableSetConfig{ description: jsii.String("Some description."), name: jsii.String("Test Varset"), - organization: cdktf.Token_AsString(tfeOrganizationTest.name), + organization: cdktf.*token_AsString(tfeOrganizationTest.name), }) /*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/ tfeVariableSetTest.OverrideLogicalId(jsii.String("test")) tfeWorkspaceTest := workspace.NewWorkspace(this, jsii.String("test_2"), &workspaceConfig{ name: jsii.String("my-workspace-name"), - organization: cdktf.Token_*AsString(tfeOrganizationTest.name), + organization: cdktf.*token_*AsString(tfeOrganizationTest.name), }) /*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/ tfeWorkspaceTest.OverrideLogicalId(jsii.String("test")) tfeWorkspaceVariableSetTest := workspaceVariableSet.NewWorkspaceVariableSet(this, jsii.String("test_3"), &workspaceVariableSetConfig{ - variableSetId: cdktf.Token_*AsString(tfeVariableSetTest.id), - workspaceId: cdktf.Token_*AsString(tfeWorkspaceTest.id), + variableSetId: cdktf.*token_*AsString(tfeVariableSetTest.id), + workspaceId: cdktf.*token_*AsString(tfeWorkspaceTest.id), }) /*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/ tfeWorkspaceVariableSetTest.OverrideLogicalId(jsii.String("test")) @@ -80,4 +80,4 @@ Workspace Variable Sets can be imported; use `// \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/java/d/variable_set.html.markdown b/website/docs/cdktf/java/d/variable_set.html.markdown index 5368234d0..2e76b8246 100644 --- a/website/docs/cdktf/java/d/variable_set.html.markdown +++ b/website/docs/cdktf/java/d/variable_set.html.markdown @@ -50,5 +50,6 @@ The following arguments are supported: * `workspaceIds` - IDs of the workspaces that use the variable set. * `variableIds` - IDs of the variables attached to the variable set. * `projectIds` - IDs of the projects that use the variable set. +* `parentProjectId` - ID of the project that owns the variable set. - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/java/index.html.markdown b/website/docs/cdktf/java/index.html.markdown index 2b6f422a8..af9fbc429 100644 --- a/website/docs/cdktf/java/index.html.markdown +++ b/website/docs/cdktf/java/index.html.markdown @@ -77,7 +77,7 @@ automatically installed by `terraform init` in the future: terraform { required_providers { tfe = { - version = "~> 0.60.0" + version = "~> 0.62.0" } } } @@ -90,7 +90,7 @@ The above snippet using `requiredProviders` is for Terraform 0.13+; if you are u ```hcl provider "tfe" { - version = "~> 0.60.0" + version = "~> 0.62.0" ... } ``` @@ -103,7 +103,7 @@ For more information on provider installation and constraining provider versions provider "tfe" { hostname = var.hostname # Optional, defaults to HCP Terraform `appTerraformIo` token = var.token - version = "~> 0.60.0" + version = "~> 0.62.0" } # Create an organization @@ -129,4 +129,4 @@ The following arguments are supported: arguments. Ensure that the organization already exists prior to using this argument. This can also be specified using the `tfeOrganization` environment variable. - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/java/r/audit_trail_token.html.markdown b/website/docs/cdktf/java/r/audit_trail_token.html.markdown new file mode 100644 index 000000000..258500264 --- /dev/null +++ b/website/docs/cdktf/java/r/audit_trail_token.html.markdown @@ -0,0 +1,77 @@ +--- +layout: "tfe" +page_title: "Terraform Enterprise: tfe_audit_trail_token" +description: |- + Generates a new audit trail token in organization, replacing any existing token. +--- + + + +# tfe_audit_trail_token + +Generates a new audit trail token in organization, replacing any existing token. + +Note that only organizations that have the [audit-logging entitlement](https://developer.hashicorp.com/terraform/cloud-docs/api-docs#audit-logging) may create audit trail tokens. + +## Example Usage + +Basic usage: + +```java +import software.constructs.*; +import com.hashicorp.cdktf.*; +/*Provider bindings are generated by running cdktf get. +See https://cdk.tf/provider-generation for more details.*/ +import gen.providers.tfe.auditTrailToken.*; +public class MyConvertedCode extends TerraformStack { + public MyConvertedCode(Construct scope, String name) { + super(scope, name); + new AuditTrailToken(this, "test", new AuditTrailTokenConfig() + .organization("my-org-name") + ); + } +} +``` + +## Argument Reference + +The following arguments are supported: + +* `organization` - (Optional) Name of the organization. If omitted, organization must be defined in the provider config. +* `forceRegenerate` - (Optional) If set to `true`, a new token will be + generated even if a token already exists. This will invalidate the existing + token! +* `expiredAt` - (Optional) The token's expiration date. The expiration date must be a date/time string in RFC3339 +format (e.g., "2024-12-31T23:59:59Z"). If no expiration date is supplied, the expiration date will default to null and +never expire. + +## Example Usage + +When a token has an expiry: + +```hcl +resource "time_rotating" "example" { + rotation_days = 30 +} + +resource "tfe_audit_trail_token" "test" { + organization = data.tfe_organization.org.name + expired_at = time_rotating.example.rotation_rfc3339 +} +``` + +## Attributes Reference + +* `id` - The ID of the token. +* `token` - The generated token. + +## Import + +Audit trail tokens can be imported; use `` as the import ID. +For example: + +```shell +terraform import tfe_audit_trail_token.test my-org-name +``` + + \ No newline at end of file diff --git a/website/docs/cdktf/java/r/project_variable_set.html.markdown b/website/docs/cdktf/java/r/project_variable_set.html.markdown index d9d44921a..ad95b1e7a 100644 --- a/website/docs/cdktf/java/r/project_variable_set.html.markdown +++ b/website/docs/cdktf/java/r/project_variable_set.html.markdown @@ -5,9 +5,15 @@ description: |- Add a variable set to a project --- + + # tfe_project_variable_set -Adds and removes variable sets from a project +Adds and removes a project from a variable set's scope. + +-> **Note:** This resource controls whether a project has access to a variable set, not whether +a project owns the variable set. Ownership is specified by setting the `parentProjectId` on the +`tfeVariableSet` resource. ## Example Usage @@ -72,4 +78,4 @@ Project Variable Sets can be imported; use `// \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/java/r/variable_set.html.markdown b/website/docs/cdktf/java/r/variable_set.html.markdown index f944e4120..f4a65b00f 100644 --- a/website/docs/cdktf/java/r/variable_set.html.markdown +++ b/website/docs/cdktf/java/r/variable_set.html.markdown @@ -171,6 +171,100 @@ public class MyConvertedCode extends TerraformStack { } ``` +Creating a project-owned variable set that is applied to all workspaces in the project: + +```java +import software.constructs.*; +import com.hashicorp.cdktf.*; +/*Provider bindings are generated by running cdktf get. +See https://cdk.tf/provider-generation for more details.*/ +import gen.providers.tfe.organization.*; +import gen.providers.tfe.project.*; +import gen.providers.tfe.variableSet.*; +import gen.providers.tfe.projectVariableSet.*; +public class MyConvertedCode extends TerraformStack { + public MyConvertedCode(Construct scope, String name) { + super(scope, name); + Organization tfeOrganizationTest = new Organization(this, "test", new OrganizationConfig() + .email("admin@company.com") + .name("my-org-name") + ); + Project tfeProjectTest = new Project(this, "test_1", new ProjectConfig() + .name("projectname") + .organization(Token.asString(tfeOrganizationTest.getName())) + ); + /*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/ + tfeProjectTest.overrideLogicalId("test"); + VariableSet tfeVariableSetTest = new VariableSet(this, "test_2", new VariableSetConfig() + .description("Varset that is owned and managed by a project.") + .name("Project-owned Varset") + .organization(Token.asString(tfeOrganizationTest.getName())) + .parentProjectId(Token.asString(tfeProjectTest.getId())) + ); + /*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/ + tfeVariableSetTest.overrideLogicalId("test"); + ProjectVariableSet tfeProjectVariableSetTest = + new ProjectVariableSet(this, "test_3", new ProjectVariableSetConfig() + .projectId(Token.asString(tfeProjectTest.getId())) + .variableSetId(Token.asString(tfeVariableSetTest.getId())) + ); + /*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/ + tfeProjectVariableSetTest.overrideLogicalId("test"); + } +} +``` + +Creating a project-owned variable set that is applied to specific workspaces: + +```java +import software.constructs.*; +import com.hashicorp.cdktf.*; +/*Provider bindings are generated by running cdktf get. +See https://cdk.tf/provider-generation for more details.*/ +import gen.providers.tfe.organization.*; +import gen.providers.tfe.project.*; +import gen.providers.tfe.variableSet.*; +import gen.providers.tfe.workspace.*; +import gen.providers.tfe.workspaceVariableSet.*; +public class MyConvertedCode extends TerraformStack { + public MyConvertedCode(Construct scope, String name) { + super(scope, name); + Organization tfeOrganizationTest = new Organization(this, "test", new OrganizationConfig() + .email("admin@company.com") + .name("my-org-name") + ); + Project tfeProjectTest = new Project(this, "test_1", new ProjectConfig() + .name("projectname") + .organization(Token.asString(tfeOrganizationTest.getName())) + ); + /*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/ + tfeProjectTest.overrideLogicalId("test"); + VariableSet tfeVariableSetTest = new VariableSet(this, "test_2", new VariableSetConfig() + .description("Varset that is owned and managed by a project.") + .name("Project-owned Varset") + .organization(Token.asString(tfeOrganizationTest.getName())) + .parentProjectId(Token.asString(tfeProjectTest.getId())) + ); + /*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/ + tfeVariableSetTest.overrideLogicalId("test"); + Workspace tfeWorkspaceTest = new Workspace(this, "test_3", new WorkspaceConfig() + .name("my-workspace-name") + .organization(Token.asString(tfeOrganizationTest.getName())) + .projectId(Token.asString(tfeProjectTest.getId())) + ); + /*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/ + tfeWorkspaceTest.overrideLogicalId("test"); + WorkspaceVariableSet tfeWorkspaceVariableSetTest = + new WorkspaceVariableSet(this, "test_4", new WorkspaceVariableSetConfig() + .variableSetId(Token.asString(tfeVariableSetTest.getId())) + .workspaceId(Token.asString(tfeWorkspaceTest.getId())) + ); + /*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/ + tfeWorkspaceVariableSetTest.overrideLogicalId("test"); + } +} +``` + ## Argument Reference The following arguments are supported: @@ -184,6 +278,8 @@ The following arguments are supported: Must not be set if `global` is set. This argument is mutually exclusive with using the resource [tfe_workspace_variable_set](workspace_variable_set.html) which is the preferred method of associating a workspace with a variable set. +* `parentProjectId` - (Optional) ID of the project that should own the variable set. If set, than the value of `global` must be `false`. + To assign whether a variable set should be applied to a project, use the [`tfeProjectVariableSet`](project_variable_set.html) resource. ## Attributes Reference @@ -197,4 +293,4 @@ Variable sets can be imported; use `` as the import ID. For exa terraform import tfe_variable_set.test varset-5rTwnSaRPogw6apb ``` - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/java/r/workspace.html.markdown b/website/docs/cdktf/java/r/workspace.html.markdown index bb5bbefa0..f52f3ce82 100644 --- a/website/docs/cdktf/java/r/workspace.html.markdown +++ b/website/docs/cdktf/java/r/workspace.html.markdown @@ -13,8 +13,6 @@ Provides a workspace resource. ~> **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"`. -~> **NOTE:** Using `globalRemoteState` or `remoteStateConsumerIds` requires using the provider with HCP Terraform or an instance of Terraform Enterprise at least as recent as v202104-1. - ## Example Usage Basic usage: @@ -102,7 +100,7 @@ The following arguments are supported: trigger prefixes describe a set of paths which must contain changes for a VCS push to trigger a run. If disabled, any push will trigger a run. * `forceDelete` - (Optional) If this attribute is present on a workspace that is being deleted through the provider, it will use the existing force delete API. If this attribute is not present or false it will safe delete the workspace. -* `globalRemoteState` - (Optional) Whether the workspace allows all workspaces in the organization to access its state data during runs. If false, then only specifically approved workspaces can access its state (`remoteStateConsumerIds`). +* `globalRemoteState` - (Optional) **Deprecated** Whether the workspace allows all workspaces in the organization to access its state data during runs. Use [tfe_workspace_settings](workspace_settings) instead. * `operations` - **Deprecated** Whether to use remote execution mode. Defaults to `true`. When set to `false`, the workspace will be used for state storage only. This value _must not_ be provided if `executionMode` is @@ -117,7 +115,7 @@ The following arguments are supported: is `false`. The provider uses `true` as any workspace provisioned with `false` would need to then have a run manually queued out-of-band before accepting webhooks. -* `remoteStateConsumerIds` - (Optional) The set of workspace IDs set as explicit remote state consumers for the given workspace. +* `remoteStateConsumerIds` - (Optional) **Deprecated** The set of workspace IDs set as explicit remote state consumers for the given workspace. Use [tfe_workspace_settings](workspace_settings) instead. * `sourceName` - (Optional) A friendly name for the application or client creating this workspace. If set, this will be displayed on the workspace as "Created via ". @@ -194,4 +192,4 @@ terraform import tfe_workspace.test ws-CH5in3chf8RJjrVd terraform import tfe_workspace.test my-org-name/my-wkspace-name ``` - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/java/r/workspace_settings.markdown b/website/docs/cdktf/java/r/workspace_settings.markdown index 75e92d0d9..8e50bda63 100644 --- a/website/docs/cdktf/java/r/workspace_settings.markdown +++ b/website/docs/cdktf/java/r/workspace_settings.markdown @@ -85,6 +85,42 @@ public class MyConvertedCode extends TerraformStack { } ``` +Using `remoteStateConsumerIds`: + +```java +import software.constructs.*; +import com.hashicorp.cdktf.*; +/*Provider bindings are generated by running cdktf get. +See https://cdk.tf/provider-generation for more details.*/ +import gen.providers.tfe.workspace.*; +import gen.providers.tfe.workspaceSettings.*; +public class MyConvertedCode extends TerraformStack { + public MyConvertedCode(Construct scope, String name) { + super(scope, name); + /*In most cases loops should be handled in the programming language context and + not inside of the Terraform context. If you are looping over something external, e.g. a variable or a file input + you should consider using a for loop. If you are looping over something only known to Terraform, e.g. a result of a data source + you need to keep this like it is.*/ + ListTerraformIterator tfeWorkspaceTestForEachIterator = TerraformIterator.fromList(Token.asAny(Fn.toset(List.of("qa", "production")))); + Workspace tfeWorkspaceTest = new Workspace(this, "test", new WorkspaceConfig() + .name("${" + tfeWorkspaceTestForEachIterator.getValue() + "}-test") + .forEach(tfeWorkspaceTestForEachIterator) + ); + /*In most cases loops should be handled in the programming language context and + not inside of the Terraform context. If you are looping over something external, e.g. a variable or a file input + you should consider using a for loop. If you are looping over something only known to Terraform, e.g. a result of a data source + you need to keep this like it is.*/ + ListTerraformIterator tfeWorkspaceSettingsTestSettingsForEachIterator = TerraformIterator.fromList(Token.asAny(Fn.toset(List.of("qa", "production")))); + new WorkspaceSettings(this, "test-settings", new WorkspaceSettingsConfig() + .globalRemoteState(false) + .remoteStateConsumerIds(Token.asList(Fn.toset(Fn.compact(Token.asList(List.of(conditional(Op.eq(tfeWorkspaceSettingsTestSettingsForEachIterator.getValue(), "production"), propertyAccess(tfeWorkspaceTest, List.of("\"qa\"", "id")), ""))))))) + .workspaceId(Token.asString(propertyAccess(propertyAccess(tfeWorkspaceTest, List.of(tfeWorkspaceSettingsTestSettingsForEachIterator.getValue())), List.of("id")))) + .forEach(tfeWorkspaceSettingsTestSettingsForEachIterator) + ); + } +} +``` + This resource may be used as a data source when no optional arguments are defined: ```java @@ -123,6 +159,8 @@ The following arguments are supported: to be set to `agent`. This value _must not_ be provided if `executionMode` is set to any other value. * `executionMode` - (Optional) Which [execution mode](https://developer.hashicorp.com/terraform/cloud-docs/workspaces/settings#execution-mode) to use. Using HCP Terraform, valid values are `remote`, `local` or `agent`. 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. +* `globalRemoteState` - (Optional) Whether the workspace allows all workspaces in the organization to access its state data during runs. If false, then only specifically approved workspaces can access its state (`remoteStateConsumerIds`). By default, HashiCorp recommends you do not allow other workspaces to access their state. We recommend that you follow the principle of least privilege and only enable state access between workspaces that specifically need information from each other. +* `remoteStateConsumerIds` - (Optional) The set of workspace IDs set as explicit remote state consumers for the given workspace. To set this attribute, global_remote_state must be false. ## Attributes Reference @@ -146,4 +184,4 @@ terraform import tfe_workspace_settings.test ws-CH5in3chf8RJjrVd terraform import tfe_workspace_settings.test my-org-name/my-wkspace-name ``` - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/java/r/workspace_variable_set.html.markdown b/website/docs/cdktf/java/r/workspace_variable_set.html.markdown index 52ada170f..143e63e4c 100644 --- a/website/docs/cdktf/java/r/workspace_variable_set.html.markdown +++ b/website/docs/cdktf/java/r/workspace_variable_set.html.markdown @@ -9,7 +9,7 @@ description: |- # tfe_workspace_variable_set -Adds and removes variable sets from a workspace +Adds and removes a workspace from a variable set's scope. -> **Note:** `tfeVariableSet` has a deprecated argument `workspaceIds` that should not be used alongside this resource. They attempt to manage the same attachments and are mutually exclusive. @@ -76,4 +76,4 @@ Workspace Variable Sets can be imported; use `// \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/python/d/variable_set.html.markdown b/website/docs/cdktf/python/d/variable_set.html.markdown index 3db389fb4..26db5cdb1 100644 --- a/website/docs/cdktf/python/d/variable_set.html.markdown +++ b/website/docs/cdktf/python/d/variable_set.html.markdown @@ -48,5 +48,6 @@ The following arguments are supported: * `workspace_ids` - IDs of the workspaces that use the variable set. * `variable_ids` - IDs of the variables attached to the variable set. * `project_ids` - IDs of the projects that use the variable set. +* `parent_project_id` - ID of the project that owns the variable set. - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/python/index.html.markdown b/website/docs/cdktf/python/index.html.markdown index be69bef14..4192caca0 100644 --- a/website/docs/cdktf/python/index.html.markdown +++ b/website/docs/cdktf/python/index.html.markdown @@ -77,7 +77,7 @@ automatically installed by `terraform init` in the future: terraform { required_providers { tfe = { - version = "~> 0.60.0" + version = "~> 0.62.0" } } } @@ -90,7 +90,7 @@ The above snippet using `required_providers` is for Terraform 0.13+; if you are ```hcl provider "tfe" { - version = "~> 0.60.0" + version = "~> 0.62.0" ... } ``` @@ -103,7 +103,7 @@ For more information on provider installation and constraining provider versions provider "tfe" { hostname = var.hostname # Optional, defaults to HCP Terraform `app.terraform.io` token = var.token - version = "~> 0.60.0" + version = "~> 0.62.0" } # Create an organization @@ -129,4 +129,4 @@ The following arguments are supported: arguments. Ensure that the organization already exists prior to using this argument. This can also be specified using the `TFE_ORGANIZATION` environment variable. - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/python/r/audit_trail_token.html.markdown b/website/docs/cdktf/python/r/audit_trail_token.html.markdown new file mode 100644 index 000000000..f1cf4e87d --- /dev/null +++ b/website/docs/cdktf/python/r/audit_trail_token.html.markdown @@ -0,0 +1,75 @@ +--- +layout: "tfe" +page_title: "Terraform Enterprise: tfe_audit_trail_token" +description: |- + Generates a new audit trail token in organization, replacing any existing token. +--- + + + +# tfe_audit_trail_token + +Generates a new audit trail token in organization, replacing any existing token. + +Note that only organizations that have the [audit-logging entitlement](https://developer.hashicorp.com/terraform/cloud-docs/api-docs#audit-logging) may create audit trail tokens. + +## Example Usage + +Basic usage: + +```python +import constructs as constructs +import cdktf as cdktf +# Provider bindings are generated by running cdktf get. +# See https://cdk.tf/provider-generation for more details. +import ...gen.providers.tfe as tfe +class MyConvertedCode(cdktf.TerraformStack): + def __init__(self, scope, name): + super().__init__(scope, name) + tfe.audit_trail_token.AuditTrailToken(self, "test", + organization="my-org-name" + ) +``` + +## Argument Reference + +The following arguments are supported: + +* `organization` - (Optional) Name of the organization. If omitted, organization must be defined in the provider config. +* `force_regenerate` - (Optional) If set to `true`, a new token will be + generated even if a token already exists. This will invalidate the existing + token! +* `expired_at` - (Optional) The token's expiration date. The expiration date must be a date/time string in RFC3339 +format (e.g., "2024-12-31T23:59:59Z"). If no expiration date is supplied, the expiration date will default to null and +never expire. + +## Example Usage + +When a token has an expiry: + +```hcl +resource "time_rotating" "example" { + rotation_days = 30 +} + +resource "tfe_audit_trail_token" "test" { + organization = data.tfe_organization.org.name + expired_at = time_rotating.example.rotation_rfc3339 +} +``` + +## Attributes Reference + +* `id` - The ID of the token. +* `token` - The generated token. + +## Import + +Audit trail tokens can be imported; use `` as the import ID. +For example: + +```shell +terraform import tfe_audit_trail_token.test my-org-name +``` + + \ No newline at end of file diff --git a/website/docs/cdktf/python/r/project_variable_set.html.markdown b/website/docs/cdktf/python/r/project_variable_set.html.markdown index da5561bc7..438752038 100644 --- a/website/docs/cdktf/python/r/project_variable_set.html.markdown +++ b/website/docs/cdktf/python/r/project_variable_set.html.markdown @@ -9,7 +9,11 @@ description: |- # tfe_project_variable_set -Adds and removes variable sets from a project +Adds and removes a project from a variable set's scope. + +-> **Note:** This resource controls whether a project has access to a variable set, not whether +a project owns the variable set. Ownership is specified by setting the `parent_project_id` on the +`tfe_variable_set` resource. ## Example Usage @@ -69,4 +73,4 @@ Project Variable Sets can be imported; use `// \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/python/r/variable_set.html.markdown b/website/docs/cdktf/python/r/variable_set.html.markdown index 524373524..19651744c 100644 --- a/website/docs/cdktf/python/r/variable_set.html.markdown +++ b/website/docs/cdktf/python/r/variable_set.html.markdown @@ -155,6 +155,89 @@ class MyConvertedCode(cdktf.TerraformStack): ) ``` +Creating a project-owned variable set that is applied to all workspaces in the project: + +```python +import constructs as constructs +import cdktf as cdktf +# Provider bindings are generated by running cdktf get. +# See https://cdk.tf/provider-generation for more details. +import ...gen.providers.tfe as tfe +class MyConvertedCode(cdktf.TerraformStack): + def __init__(self, scope, name): + super().__init__(scope, name) + tfe_organization_test = tfe.organization.Organization(self, "test", + email="admin@company.com", + name="my-org-name" + ) + tfe_project_test = tfe.project.Project(self, "test_1", + name="projectname", + organization=cdktf.Token.as_string(tfe_organization_test.name) + ) + # This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match. + tfe_project_test.override_logical_id("test") + tfe_variable_set_test = tfe.variable_set.VariableSet(self, "test_2", + description="Varset that is owned and managed by a project.", + name="Project-owned Varset", + organization=cdktf.Token.as_string(tfe_organization_test.name), + parent_project_id=cdktf.Token.as_string(tfe_project_test.id) + ) + # This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match. + tfe_variable_set_test.override_logical_id("test") + tfe_project_variable_set_test = + tfe.project_variable_set.ProjectVariableSet(self, "test_3", + project_id=cdktf.Token.as_string(tfe_project_test.id), + variable_set_id=cdktf.Token.as_string(tfe_variable_set_test.id) + ) + # This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match. + tfe_project_variable_set_test.override_logical_id("test") +``` + +Creating a project-owned variable set that is applied to specific workspaces: + +```python +import constructs as constructs +import cdktf as cdktf +# Provider bindings are generated by running cdktf get. +# See https://cdk.tf/provider-generation for more details. +import ...gen.providers.tfe as tfe +class MyConvertedCode(cdktf.TerraformStack): + def __init__(self, scope, name): + super().__init__(scope, name) + tfe_organization_test = tfe.organization.Organization(self, "test", + email="admin@company.com", + name="my-org-name" + ) + tfe_project_test = tfe.project.Project(self, "test_1", + name="projectname", + organization=cdktf.Token.as_string(tfe_organization_test.name) + ) + # This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match. + tfe_project_test.override_logical_id("test") + tfe_variable_set_test = tfe.variable_set.VariableSet(self, "test_2", + description="Varset that is owned and managed by a project.", + name="Project-owned Varset", + organization=cdktf.Token.as_string(tfe_organization_test.name), + parent_project_id=cdktf.Token.as_string(tfe_project_test.id) + ) + # This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match. + tfe_variable_set_test.override_logical_id("test") + tfe_workspace_test = tfe.workspace.Workspace(self, "test_3", + name="my-workspace-name", + organization=cdktf.Token.as_string(tfe_organization_test.name), + project_id=cdktf.Token.as_string(tfe_project_test.id) + ) + # This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match. + tfe_workspace_test.override_logical_id("test") + tfe_workspace_variable_set_test = + tfe.workspace_variable_set.WorkspaceVariableSet(self, "test_4", + variable_set_id=cdktf.Token.as_string(tfe_variable_set_test.id), + workspace_id=cdktf.Token.as_string(tfe_workspace_test.id) + ) + # This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match. + tfe_workspace_variable_set_test.override_logical_id("test") +``` + ## Argument Reference The following arguments are supported: @@ -168,6 +251,8 @@ The following arguments are supported: Must not be set if `global` is set. This argument is mutually exclusive with using the resource [tfe_workspace_variable_set](workspace_variable_set.html) which is the preferred method of associating a workspace with a variable set. +* `parent_project_id` - (Optional) ID of the project that should own the variable set. If set, than the value of `global` must be `false`. + To assign whether a variable set should be applied to a project, use the [`tfe_project_variable_set`](project_variable_set.html) resource. ## Attributes Reference @@ -181,4 +266,4 @@ Variable sets can be imported; use `` as the import ID. For exa terraform import tfe_variable_set.test varset-5rTwnSaRPogw6apb ``` - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/python/r/workspace.html.markdown b/website/docs/cdktf/python/r/workspace.html.markdown index 5a4c43b5e..db45e9189 100644 --- a/website/docs/cdktf/python/r/workspace.html.markdown +++ b/website/docs/cdktf/python/r/workspace.html.markdown @@ -13,8 +13,6 @@ Provides a workspace resource. ~> **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"`. -~> **NOTE:** Using `global_remote_state` or `remote_state_consumer_ids` requires using the provider with HCP Terraform or an instance of Terraform Enterprise at least as recent as v202104-1. - ## Example Usage Basic usage: @@ -95,7 +93,7 @@ The following arguments are supported: trigger prefixes describe a set of paths which must contain changes for a VCS push to trigger a run. If disabled, any push will trigger a run. * `force_delete` - (Optional) If this attribute is present on a workspace that is being deleted through the provider, it will use the existing force delete API. If this attribute is not present or false it will safe delete the workspace. -* `global_remote_state` - (Optional) Whether the workspace allows all workspaces in the organization to access its state data during runs. If false, then only specifically approved workspaces can access its state (`remote_state_consumer_ids`). +* `global_remote_state` - (Optional) **Deprecated** Whether the workspace allows all workspaces in the organization to access its state data during runs. Use [tfe_workspace_settings](workspace_settings) instead. * `operations` - **Deprecated** Whether to use remote execution mode. Defaults to `true`. When set to `false`, the workspace will be used for state storage only. This value _must not_ be provided if `execution_mode` is @@ -110,7 +108,7 @@ The following arguments are supported: is `false`. The provider uses `true` as any workspace provisioned with `false` would need to then have a run manually queued out-of-band before accepting webhooks. -* `remote_state_consumer_ids` - (Optional) The set of workspace IDs set as explicit remote state consumers for the given workspace. +* `remote_state_consumer_ids` - (Optional) **Deprecated** The set of workspace IDs set as explicit remote state consumers for the given workspace. Use [tfe_workspace_settings](workspace_settings) instead. * `source_name` - (Optional) A friendly name for the application or client creating this workspace. If set, this will be displayed on the workspace as "Created via ". @@ -187,4 +185,4 @@ terraform import tfe_workspace.test ws-CH5in3chf8RJjrVd terraform import tfe_workspace.test my-org-name/my-wkspace-name ``` - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/python/r/workspace_settings.markdown b/website/docs/cdktf/python/r/workspace_settings.markdown index 3810d9583..cc4ed19c8 100644 --- a/website/docs/cdktf/python/r/workspace_settings.markdown +++ b/website/docs/cdktf/python/r/workspace_settings.markdown @@ -15,21 +15,27 @@ Manages or reads execution mode and agent pool settings for a workspace. This al Basic usage: -```hcl -resource "tfe_organization" "test-organization" { - name = "my-org-name" - email = "admin@company.com" -} - -resource "tfe_workspace" "test" { - name = "my-workspace-name" - organization = tfe_organization.test-organization.name -} - -resource "tfe_workspace_settings" "test-settings" { - workspace_id = tfe_workspace.test.id - execution_mode = "local" -} +```python +import constructs as constructs +import cdktf as cdktf +# Provider bindings are generated by running cdktf get. +# See https://cdk.tf/provider-generation for more details. +import ...gen.providers.tfe as tfe +class MyConvertedCode(cdktf.TerraformStack): + def __init__(self, scope, name): + super().__init__(scope, name) + tfe_organization_test_organization = tfe.organization.Organization(self, "test-organization", + email="admin@company.com", + name="my-org-name" + ) + tfe_workspace_test = tfe.workspace.Workspace(self, "test", + name="my-workspace-name", + organization=cdktf.Token.as_string(tfe_organization_test_organization.name) + ) + tfe.workspace_settings.WorkspaceSettings(self, "test-settings", + execution_mode="local", + workspace_id=cdktf.Token.as_string(tfe_workspace_test.id) + ) ``` With `execution_mode` of `agent`: @@ -69,6 +75,52 @@ class MyConvertedCode(cdktf.TerraformStack): ) ``` +Using `remote_state_consumer_ids`: + +```python +import constructs as constructs +import cdktf as cdktf +# Provider bindings are generated by running cdktf get. +# See https://cdk.tf/provider-generation for more details. +import ...gen.providers.tfe as tfe +class MyConvertedCode(cdktf.TerraformStack): + def __init__(self, scope, name): + super().__init__(scope, name) + # In most cases loops should be handled in the programming language context and + # not inside of the Terraform context. If you are looping over something external, e.g. a variable or a file input + # you should consider using a for loop. If you are looping over something only known to Terraform, e.g. a result of a data source + # you need to keep this like it is. + tfe_workspace_test_for_each_iterator = cdktf.TerraformIterator.from_list( + cdktf.Token.as_any(cdktf.Fn.toset(["qa", "production"]))) + tfe_workspace_test = tfe.workspace.Workspace(self, "test", + name="${" + tfe_workspace_test_for_each_iterator.value + "}-test", + for_each=tfe_workspace_test_for_each_iterator + ) + # In most cases loops should be handled in the programming language context and + # not inside of the Terraform context. If you are looping over something external, e.g. a variable or a file input + # you should consider using a for loop. If you are looping over something only known to Terraform, e.g. a result of a data source + # you need to keep this like it is. + tfe_workspace_settings_test_settings_for_each_iterator = + cdktf.TerraformIterator.from_list( + cdktf.Token.as_any(cdktf.Fn.toset(["qa", "production"]))) + tfe.workspace_settings.WorkspaceSettings(self, "test-settings", + global_remote_state=False, + remote_state_consumer_ids=cdktf.Token.as_list( + cdktf.Fn.toset( + cdktf.Fn.compact( + cdktf.Token.as_list([ + cdktf.conditional( + cdktf.Op.eq(tfe_workspace_settings_test_settings_for_each_iterator.value, "production"), + cdktf.property_access(tfe_workspace_test, ["\"qa\"", "id"]), "") + ])))), + workspace_id=cdktf.Token.as_string( + cdktf.property_access( + cdktf.property_access(tfe_workspace_test, [tfe_workspace_settings_test_settings_for_each_iterator.value + ]), ["id"])), + for_each=tfe_workspace_settings_test_settings_for_each_iterator + ) +``` + This resource may be used as a data source when no optional arguments are defined: ```python @@ -109,6 +161,8 @@ The following arguments are supported: to be set to `agent`. This value _must not_ be provided if `execution_mode` is set to any other value. * `execution_mode` - (Optional) Which [execution mode](https://developer.hashicorp.com/terraform/cloud-docs/workspaces/settings#execution-mode) to use. Using HCP Terraform, valid values are `remote`, `local` or `agent`. 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. +* `global_remote_state` - (Optional) Whether the workspace allows all workspaces in the organization to access its state data during runs. If false, then only specifically approved workspaces can access its state (`remote_state_consumer_ids`). By default, HashiCorp recommends you do not allow other workspaces to access their state. We recommend that you follow the principle of least privilege and only enable state access between workspaces that specifically need information from each other. +* `remote_state_consumer_ids` - (Optional) The set of workspace IDs set as explicit remote state consumers for the given workspace. To set this attribute, global_remote_state must be false. ## Attributes Reference @@ -132,4 +186,4 @@ terraform import tfe_workspace_settings.test ws-CH5in3chf8RJjrVd terraform import tfe_workspace_settings.test my-org-name/my-wkspace-name ``` - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/python/r/workspace_variable_set.html.markdown b/website/docs/cdktf/python/r/workspace_variable_set.html.markdown index fdaee2908..8db842929 100644 --- a/website/docs/cdktf/python/r/workspace_variable_set.html.markdown +++ b/website/docs/cdktf/python/r/workspace_variable_set.html.markdown @@ -9,7 +9,7 @@ description: |- # tfe_workspace_variable_set -Adds and removes variable sets from a workspace +Adds and removes a workspace from a variable set's scope. -> **Note:** `tfe_variable_set` has a deprecated argument `workspace_ids` that should not be used alongside this resource. They attempt to manage the same attachments and are mutually exclusive. @@ -17,27 +17,39 @@ Adds and removes variable sets from a workspace Basic usage: -```hcl -resource "tfe_organization" "test" { - name = "my-org-name" - email = "admin@company.com" -} - -resource "tfe_workspace" "test" { - name = "my-workspace-name" - organization = tfe_organization.test.name -} - -resource "tfe_variable_set" "test" { - name = "Test Varset" - description = "Some description." - organization = tfe_organization.test.name -} - -resource "tfe_workspace_variable_set" "test" { - variable_set_id = tfe_variable_set.test.id - workspace_id = tfe_workspace.test.id -} +```python +import constructs as constructs +import cdktf as cdktf +# Provider bindings are generated by running cdktf get. +# See https://cdk.tf/provider-generation for more details. +import ...gen.providers.tfe as tfe +class MyConvertedCode(cdktf.TerraformStack): + def __init__(self, scope, name): + super().__init__(scope, name) + tfe_organization_test = tfe.organization.Organization(self, "test", + email="admin@company.com", + name="my-org-name" + ) + tfe_variable_set_test = tfe.variable_set.VariableSet(self, "test_1", + description="Some description.", + name="Test Varset", + organization=cdktf.Token.as_string(tfe_organization_test.name) + ) + # This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match. + tfe_variable_set_test.override_logical_id("test") + tfe_workspace_test = tfe.workspace.Workspace(self, "test_2", + name="my-workspace-name", + organization=cdktf.Token.as_string(tfe_organization_test.name) + ) + # This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match. + tfe_workspace_test.override_logical_id("test") + tfe_workspace_variable_set_test = + tfe.workspace_variable_set.WorkspaceVariableSet(self, "test_3", + variable_set_id=cdktf.Token.as_string(tfe_variable_set_test.id), + workspace_id=cdktf.Token.as_string(tfe_workspace_test.id) + ) + # This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match. + tfe_workspace_variable_set_test.override_logical_id("test") ``` ## Argument Reference @@ -59,4 +71,4 @@ Workspace Variable Sets can be imported; use `// \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/typescript/d/variable_set.html.markdown b/website/docs/cdktf/typescript/d/variable_set.html.markdown index c5bab02a4..882358ff0 100644 --- a/website/docs/cdktf/typescript/d/variable_set.html.markdown +++ b/website/docs/cdktf/typescript/d/variable_set.html.markdown @@ -51,5 +51,6 @@ The following arguments are supported: * `workspaceIds` - IDs of the workspaces that use the variable set. * `variableIds` - IDs of the variables attached to the variable set. * `projectIds` - IDs of the projects that use the variable set. +* `parentProjectId` - ID of the project that owns the variable set. - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/typescript/index.html.markdown b/website/docs/cdktf/typescript/index.html.markdown index 2b6f422a8..af9fbc429 100644 --- a/website/docs/cdktf/typescript/index.html.markdown +++ b/website/docs/cdktf/typescript/index.html.markdown @@ -77,7 +77,7 @@ automatically installed by `terraform init` in the future: terraform { required_providers { tfe = { - version = "~> 0.60.0" + version = "~> 0.62.0" } } } @@ -90,7 +90,7 @@ The above snippet using `requiredProviders` is for Terraform 0.13+; if you are u ```hcl provider "tfe" { - version = "~> 0.60.0" + version = "~> 0.62.0" ... } ``` @@ -103,7 +103,7 @@ For more information on provider installation and constraining provider versions provider "tfe" { hostname = var.hostname # Optional, defaults to HCP Terraform `appTerraformIo` token = var.token - version = "~> 0.60.0" + version = "~> 0.62.0" } # Create an organization @@ -129,4 +129,4 @@ The following arguments are supported: arguments. Ensure that the organization already exists prior to using this argument. This can also be specified using the `tfeOrganization` environment variable. - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/typescript/r/audit_trail_token.html.markdown b/website/docs/cdktf/typescript/r/audit_trail_token.html.markdown new file mode 100644 index 000000000..9287be602 --- /dev/null +++ b/website/docs/cdktf/typescript/r/audit_trail_token.html.markdown @@ -0,0 +1,78 @@ +--- +layout: "tfe" +page_title: "Terraform Enterprise: tfe_audit_trail_token" +description: |- + Generates a new audit trail token in organization, replacing any existing token. +--- + + + +# tfe_audit_trail_token + +Generates a new audit trail token in organization, replacing any existing token. + +Note that only organizations that have the [audit-logging entitlement](https://developer.hashicorp.com/terraform/cloud-docs/api-docs#audit-logging) may create audit trail tokens. + +## Example Usage + +Basic usage: + +```typescript +import * as constructs from "constructs"; +import * as cdktf from "cdktf"; +/*Provider bindings are generated by running cdktf get. +See https://cdk.tf/provider-generation for more details.*/ +import * as tfe from "./.gen/providers/tfe"; +class MyConvertedCode extends cdktf.TerraformStack { + constructor(scope: constructs.Construct, name: string) { + super(scope, name); + new tfe.auditTrailToken.AuditTrailToken(this, "test", { + organization: "my-org-name", + }); + } +} + +``` + +## Argument Reference + +The following arguments are supported: + +* `organization` - (Optional) Name of the organization. If omitted, organization must be defined in the provider config. +* `forceRegenerate` - (Optional) If set to `true`, a new token will be + generated even if a token already exists. This will invalidate the existing + token! +* `expiredAt` - (Optional) The token's expiration date. The expiration date must be a date/time string in RFC3339 +format (e.g., "2024-12-31T23:59:59Z"). If no expiration date is supplied, the expiration date will default to null and +never expire. + +## Example Usage + +When a token has an expiry: + +```hcl +resource "time_rotating" "example" { + rotation_days = 30 +} + +resource "tfe_audit_trail_token" "test" { + organization = data.tfe_organization.org.name + expired_at = time_rotating.example.rotation_rfc3339 +} +``` + +## Attributes Reference + +* `id` - The ID of the token. +* `token` - The generated token. + +## Import + +Audit trail tokens can be imported; use `` as the import ID. +For example: + +```shell +terraform import tfe_audit_trail_token.test my-org-name +``` + + \ No newline at end of file diff --git a/website/docs/cdktf/typescript/r/project_variable_set.html.markdown b/website/docs/cdktf/typescript/r/project_variable_set.html.markdown index 62fa66b9d..994b5e450 100644 --- a/website/docs/cdktf/typescript/r/project_variable_set.html.markdown +++ b/website/docs/cdktf/typescript/r/project_variable_set.html.markdown @@ -9,7 +9,11 @@ description: |- # tfe_project_variable_set -Adds and removes variable sets from a project +Adds and removes a project from a variable set's scope. + +-> **Note:** This resource controls whether a project has access to a variable set, not whether +a project owns the variable set. Ownership is specified by setting the `parentProjectId` on the +`tfeVariableSet` resource. ## Example Usage @@ -76,4 +80,4 @@ Project Variable Sets can be imported; use `// \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/typescript/r/variable_set.html.markdown b/website/docs/cdktf/typescript/r/variable_set.html.markdown index ceb0d3f23..5bfc4be94 100644 --- a/website/docs/cdktf/typescript/r/variable_set.html.markdown +++ b/website/docs/cdktf/typescript/r/variable_set.html.markdown @@ -176,6 +176,103 @@ class MyConvertedCode extends cdktf.TerraformStack { ``` +Creating a project-owned variable set that is applied to all workspaces in the project: + +```typescript +import * as constructs from "constructs"; +import * as cdktf from "cdktf"; +/*Provider bindings are generated by running cdktf get. +See https://cdk.tf/provider-generation for more details.*/ +import * as tfe from "./.gen/providers/tfe"; +class MyConvertedCode extends cdktf.TerraformStack { + constructor(scope: constructs.Construct, name: string) { + super(scope, name); + const tfeOrganizationTest = new tfe.organization.Organization( + this, + "test", + { + email: "admin@company.com", + name: "my-org-name", + } + ); + const tfeProjectTest = new tfe.project.Project(this, "test_1", { + name: "projectname", + organization: cdktf.Token.asString(tfeOrganizationTest.name), + }); + /*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/ + tfeProjectTest.overrideLogicalId("test"); + const tfeVariableSetTest = new tfe.variableSet.VariableSet(this, "test_2", { + description: "Varset that is owned and managed by a project.", + name: "Project-owned Varset", + organization: cdktf.Token.asString(tfeOrganizationTest.name), + parentProjectId: cdktf.Token.asString(tfeProjectTest.id), + }); + /*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/ + tfeVariableSetTest.overrideLogicalId("test"); + const tfeProjectVariableSetTest = + new tfe.projectVariableSet.ProjectVariableSet(this, "test_3", { + projectId: cdktf.Token.asString(tfeProjectTest.id), + variableSetId: cdktf.Token.asString(tfeVariableSetTest.id), + }); + /*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/ + tfeProjectVariableSetTest.overrideLogicalId("test"); + } +} + +``` + +Creating a project-owned variable set that is applied to specific workspaces: + +```typescript +import * as constructs from "constructs"; +import * as cdktf from "cdktf"; +/*Provider bindings are generated by running cdktf get. +See https://cdk.tf/provider-generation for more details.*/ +import * as tfe from "./.gen/providers/tfe"; +class MyConvertedCode extends cdktf.TerraformStack { + constructor(scope: constructs.Construct, name: string) { + super(scope, name); + const tfeOrganizationTest = new tfe.organization.Organization( + this, + "test", + { + email: "admin@company.com", + name: "my-org-name", + } + ); + const tfeProjectTest = new tfe.project.Project(this, "test_1", { + name: "projectname", + organization: cdktf.Token.asString(tfeOrganizationTest.name), + }); + /*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/ + tfeProjectTest.overrideLogicalId("test"); + const tfeVariableSetTest = new tfe.variableSet.VariableSet(this, "test_2", { + description: "Varset that is owned and managed by a project.", + name: "Project-owned Varset", + organization: cdktf.Token.asString(tfeOrganizationTest.name), + parentProjectId: cdktf.Token.asString(tfeProjectTest.id), + }); + /*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/ + tfeVariableSetTest.overrideLogicalId("test"); + const tfeWorkspaceTest = new tfe.workspace.Workspace(this, "test_3", { + name: "my-workspace-name", + organization: cdktf.Token.asString(tfeOrganizationTest.name), + projectId: cdktf.Token.asString(tfeProjectTest.id), + }); + /*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/ + tfeWorkspaceTest.overrideLogicalId("test"); + const tfeWorkspaceVariableSetTest = + new tfe.workspaceVariableSet.WorkspaceVariableSet(this, "test_4", { + variableSetId: cdktf.Token.asString(tfeVariableSetTest.id), + workspaceId: cdktf.Token.asString(tfeWorkspaceTest.id), + }); + /*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/ + tfeWorkspaceVariableSetTest.overrideLogicalId("test"); + } +} + +``` + ## Argument Reference The following arguments are supported: @@ -189,6 +286,8 @@ The following arguments are supported: Must not be set if `global` is set. This argument is mutually exclusive with using the resource [tfe_workspace_variable_set](workspace_variable_set.html) which is the preferred method of associating a workspace with a variable set. +* `parentProjectId` - (Optional) ID of the project that should own the variable set. If set, than the value of `global` must be `false`. + To assign whether a variable set should be applied to a project, use the [`tfeProjectVariableSet`](project_variable_set.html) resource. ## Attributes Reference @@ -202,4 +301,4 @@ Variable sets can be imported; use `` as the import ID. For exa terraform import tfe_variable_set.test varset-5rTwnSaRPogw6apb ``` - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/typescript/r/workspace.html.markdown b/website/docs/cdktf/typescript/r/workspace.html.markdown index 1ded35e44..afd4fbd18 100644 --- a/website/docs/cdktf/typescript/r/workspace.html.markdown +++ b/website/docs/cdktf/typescript/r/workspace.html.markdown @@ -13,8 +13,6 @@ Provides a workspace resource. ~> **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"`. -~> **NOTE:** Using `globalRemoteState` or `remoteStateConsumerIds` requires using the provider with HCP Terraform or an instance of Terraform Enterprise at least as recent as v202104-1. - ## Example Usage Basic usage: @@ -109,7 +107,7 @@ The following arguments are supported: trigger prefixes describe a set of paths which must contain changes for a VCS push to trigger a run. If disabled, any push will trigger a run. * `forceDelete` - (Optional) If this attribute is present on a workspace that is being deleted through the provider, it will use the existing force delete API. If this attribute is not present or false it will safe delete the workspace. -* `globalRemoteState` - (Optional) Whether the workspace allows all workspaces in the organization to access its state data during runs. If false, then only specifically approved workspaces can access its state (`remoteStateConsumerIds`). +* `globalRemoteState` - (Optional) **Deprecated** Whether the workspace allows all workspaces in the organization to access its state data during runs. Use [tfe_workspace_settings](workspace_settings) instead. * `operations` - **Deprecated** Whether to use remote execution mode. Defaults to `true`. When set to `false`, the workspace will be used for state storage only. This value _must not_ be provided if `executionMode` is @@ -124,7 +122,7 @@ The following arguments are supported: is `false`. The provider uses `true` as any workspace provisioned with `false` would need to then have a run manually queued out-of-band before accepting webhooks. -* `remoteStateConsumerIds` - (Optional) The set of workspace IDs set as explicit remote state consumers for the given workspace. +* `remoteStateConsumerIds` - (Optional) **Deprecated** The set of workspace IDs set as explicit remote state consumers for the given workspace. Use [tfe_workspace_settings](workspace_settings) instead. * `sourceName` - (Optional) A friendly name for the application or client creating this workspace. If set, this will be displayed on the workspace as "Created via ". @@ -201,4 +199,4 @@ terraform import tfe_workspace.test ws-CH5in3chf8RJjrVd terraform import tfe_workspace.test my-org-name/my-wkspace-name ``` - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/typescript/r/workspace_settings.markdown b/website/docs/cdktf/typescript/r/workspace_settings.markdown index 1551ccdf1..79d7d4cf3 100644 --- a/website/docs/cdktf/typescript/r/workspace_settings.markdown +++ b/website/docs/cdktf/typescript/r/workspace_settings.markdown @@ -101,6 +101,69 @@ class MyConvertedCode extends cdktf.TerraformStack { ``` +Using `remoteStateConsumerIds`: + +```typescript +import * as constructs from "constructs"; +import * as cdktf from "cdktf"; +/*Provider bindings are generated by running cdktf get. +See https://cdk.tf/provider-generation for more details.*/ +import * as tfe from "./.gen/providers/tfe"; +class MyConvertedCode extends cdktf.TerraformStack { + constructor(scope: constructs.Construct, name: string) { + super(scope, name); + /*In most cases loops should be handled in the programming language context and + not inside of the Terraform context. If you are looping over something external, e.g. a variable or a file input + you should consider using a for loop. If you are looping over something only known to Terraform, e.g. a result of a data source + you need to keep this like it is.*/ + const tfeWorkspaceTestForEachIterator = cdktf.TerraformIterator.fromList( + cdktf.Token.asAny(cdktf.Fn.toset(["qa", "production"])) + ); + const tfeWorkspaceTest = new tfe.workspace.Workspace(this, "test", { + name: "${" + tfeWorkspaceTestForEachIterator.value + "}-test", + forEach: tfeWorkspaceTestForEachIterator, + }); + /*In most cases loops should be handled in the programming language context and + not inside of the Terraform context. If you are looping over something external, e.g. a variable or a file input + you should consider using a for loop. If you are looping over something only known to Terraform, e.g. a result of a data source + you need to keep this like it is.*/ + const tfeWorkspaceSettingsTestSettingsForEachIterator = + cdktf.TerraformIterator.fromList( + cdktf.Token.asAny(cdktf.Fn.toset(["qa", "production"])) + ); + new tfe.workspaceSettings.WorkspaceSettings(this, "test-settings", { + globalRemoteState: false, + remoteStateConsumerIds: cdktf.Token.asList( + cdktf.Fn.toset( + cdktf.Fn.compact( + cdktf.Token.asList([ + cdktf.conditional( + cdktf.Op.eq( + tfeWorkspaceSettingsTestSettingsForEachIterator.value, + "production" + ), + cdktf.propertyAccess(tfeWorkspaceTest, ['"qa"', "id"]), + "" + ), + ]) + ) + ) + ), + workspaceId: cdktf.Token.asString( + cdktf.propertyAccess( + cdktf.propertyAccess(tfeWorkspaceTest, [ + tfeWorkspaceSettingsTestSettingsForEachIterator.value, + ]), + ["id"] + ) + ), + forEach: tfeWorkspaceSettingsTestSettingsForEachIterator, + }); + } +} + +``` + This resource may be used as a data source when no optional arguments are defined: ```typescript @@ -151,6 +214,8 @@ The following arguments are supported: to be set to `agent`. This value _must not_ be provided if `executionMode` is set to any other value. * `executionMode` - (Optional) Which [execution mode](https://developer.hashicorp.com/terraform/cloud-docs/workspaces/settings#execution-mode) to use. Using HCP Terraform, valid values are `remote`, `local` or `agent`. 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. +* `globalRemoteState` - (Optional) Whether the workspace allows all workspaces in the organization to access its state data during runs. If false, then only specifically approved workspaces can access its state (`remoteStateConsumerIds`). By default, HashiCorp recommends you do not allow other workspaces to access their state. We recommend that you follow the principle of least privilege and only enable state access between workspaces that specifically need information from each other. +* `remoteStateConsumerIds` - (Optional) The set of workspace IDs set as explicit remote state consumers for the given workspace. To set this attribute, global_remote_state must be false. ## Attributes Reference @@ -174,4 +239,4 @@ terraform import tfe_workspace_settings.test ws-CH5in3chf8RJjrVd terraform import tfe_workspace_settings.test my-org-name/my-wkspace-name ``` - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/typescript/r/workspace_variable_set.html.markdown b/website/docs/cdktf/typescript/r/workspace_variable_set.html.markdown index 4026bdc60..07dab1d42 100644 --- a/website/docs/cdktf/typescript/r/workspace_variable_set.html.markdown +++ b/website/docs/cdktf/typescript/r/workspace_variable_set.html.markdown @@ -9,7 +9,7 @@ description: |- # tfe_workspace_variable_set -Adds and removes variable sets from a workspace +Adds and removes a workspace from a variable set's scope. -> **Note:** `tfeVariableSet` has a deprecated argument `workspaceIds` that should not be used alongside this resource. They attempt to manage the same attachments and are mutually exclusive. @@ -17,27 +17,46 @@ Adds and removes variable sets from a workspace Basic usage: -```hcl -resource "tfe_organization" "test" { - name = "my-org-name" - email = "admin@company.com" +```typescript +import * as constructs from "constructs"; +import * as cdktf from "cdktf"; +/*Provider bindings are generated by running cdktf get. +See https://cdk.tf/provider-generation for more details.*/ +import * as tfe from "./.gen/providers/tfe"; +class MyConvertedCode extends cdktf.TerraformStack { + constructor(scope: constructs.Construct, name: string) { + super(scope, name); + const tfeOrganizationTest = new tfe.organization.Organization( + this, + "test", + { + email: "admin@company.com", + name: "my-org-name", + } + ); + const tfeVariableSetTest = new tfe.variableSet.VariableSet(this, "test_1", { + description: "Some description.", + name: "Test Varset", + organization: cdktf.Token.asString(tfeOrganizationTest.name), + }); + /*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/ + tfeVariableSetTest.overrideLogicalId("test"); + const tfeWorkspaceTest = new tfe.workspace.Workspace(this, "test_2", { + name: "my-workspace-name", + organization: cdktf.Token.asString(tfeOrganizationTest.name), + }); + /*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/ + tfeWorkspaceTest.overrideLogicalId("test"); + const tfeWorkspaceVariableSetTest = + new tfe.workspaceVariableSet.WorkspaceVariableSet(this, "test_3", { + variableSetId: cdktf.Token.asString(tfeVariableSetTest.id), + workspaceId: cdktf.Token.asString(tfeWorkspaceTest.id), + }); + /*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/ + tfeWorkspaceVariableSetTest.overrideLogicalId("test"); + } } -resource "tfe_workspace" "test" { - name = "my-workspace-name" - organization = tfe_organization.test.name -} - -resource "tfe_variable_set" "test" { - name = "Test Varset" - description = "Some description." - organization = tfe_organization.test.name -} - -resource "tfe_workspace_variable_set" "test" { - variable_set_id = tfe_variable_set.test.id - workspace_id = tfe_workspace.test.id -} ``` ## Argument Reference @@ -59,4 +78,4 @@ Workspace Variable Sets can be imported; use `// \ No newline at end of file + \ No newline at end of file