Skip to content

Commit 9543098

Browse files
committed
Adds tfe_workspace_settings resource
This resource is added for two reasons: to break the circular dependency between tfe_workspace agent_pool_id and tfe_agent_pool_allowed_workspaces, as well as create a resource symmetry between tfe_organization_default_execution_mode (will be renamed to tfe_organization_default_settings in a followup commit)
1 parent 36b76db commit 9543098

File tree

4 files changed

+675
-9
lines changed

4 files changed

+675
-9
lines changed

internal/provider/provider_next.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ package provider
55

66
import (
77
"context"
8+
"fmt"
89
"os"
10+
"regexp"
911

1012
"github.com/hashicorp/terraform-plugin-framework/datasource"
1113
"github.com/hashicorp/terraform-plugin-framework/provider"
@@ -23,6 +25,14 @@ type frameworkProvider struct{}
2325
// Compile-time interface check
2426
var _ provider.Provider = &frameworkProvider{}
2527

28+
// Can be used to construct ID regexp patterns
29+
var base58Alphabet = "[1-9A-HJ-NP-Za-km-z]"
30+
31+
// IDPattern constructs a regexp pattern for Terraform Cloud with the given prefix
32+
func IDPattern(prefix string) *regexp.Regexp {
33+
return regexp.MustCompile(fmt.Sprintf("^%s-%s{16}$", prefix, base58Alphabet))
34+
}
35+
2636
// FrameworkProviderConfig is a helper type for extracting the provider
2737
// configuration from the provider block.
2838
type FrameworkProviderConfig struct {
@@ -121,5 +131,6 @@ func (p *frameworkProvider) Resources(ctx context.Context) []func() resource.Res
121131
return []func() resource.Resource{
122132
NewResourceVariable,
123133
NewSAMLSettingsResource,
134+
NewResourceWorkspaceSettings,
124135
}
125136
}

0 commit comments

Comments
 (0)