Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/data-sources/instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ Read-Only:
- `ssl_cert` (String)
- `ssl_key` (String)
- `type` (String)
- `use_ssl` (Boolean)
- `username` (String)

<a id="nestedobjatt--data_sources--external_secret"></a>
Expand Down
1 change: 1 addition & 0 deletions docs/data-sources/instance_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ Read-Only:
- `ssl_cert` (String)
- `ssl_key` (String)
- `type` (String)
- `use_ssl` (Boolean)
- `username` (String)

<a id="nestedobjatt--instances--data_sources--external_secret"></a>
Expand Down
1 change: 1 addition & 0 deletions docs/resources/instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ Optional:
- `ssl_ca` (String, Sensitive) The CA certificate. Optional, you can set this if the engine type is MYSQL, POSTGRES, TIDB or CLICKHOUSE.
- `ssl_cert` (String, Sensitive) The client certificate. Optional, you can set this if the engine type is MYSQL, POSTGRES, TIDB or CLICKHOUSE.
- `ssl_key` (String, Sensitive) The client key. Optional, you can set this if the engine type is MYSQL, POSTGRES, TIDB or CLICKHOUSE.
- `use_ssl` (Boolean) Enable SSL connection. Required to use SSL certificates.
- `username` (String) The connection user name used by Bytebase to perform DDL and DML operations.

<a id="nestedblock--data_sources--external_secret"></a>
Expand Down
2 changes: 1 addition & 1 deletion examples/database/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
terraform {
required_providers {
bytebase = {
version = "3.7.1"
version = "3.7.2"
# For local development, please use "terraform.local/bytebase/bytebase" instead
source = "registry.terraform.io/bytebase/bytebase"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/database_group/main.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
terraform {
required_providers {
bytebase = {
version = "3.7.1"
version = "3.7.2"
# For local development, please use "terraform.local/bytebase/bytebase" instead
source = "registry.terraform.io/bytebase/bytebase"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/environments/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ You should replace the provider initial variables with your own and exec the [se

```terraform
data "bytebase_setting" "environments" {
name = "ENVIRONMENT"
name = "settings/ENVIRONMENT"
}
```
4 changes: 2 additions & 2 deletions examples/environments/main.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
terraform {
required_providers {
bytebase = {
version = "3.7.1"
version = "3.7.2"
# For local development, please use "terraform.local/bytebase/bytebase" instead
source = "registry.terraform.io/bytebase/bytebase"
}
Expand All @@ -19,7 +19,7 @@ provider "bytebase" {

# List all environment
data "bytebase_setting" "environments" {
name = "ENVIRONMENT"
name = "settings/ENVIRONMENT"
}

output "all_environments" {
Expand Down
2 changes: 1 addition & 1 deletion examples/groups/main.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
terraform {
required_providers {
bytebase = {
version = "3.7.1"
version = "3.7.2"
# For local development, please use "terraform.local/bytebase/bytebase" instead
source = "registry.terraform.io/bytebase/bytebase"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/iamPolicy/main.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
terraform {
required_providers {
bytebase = {
version = "3.7.1"
version = "3.7.2"
# For local development, please use "terraform.local/bytebase/bytebase" instead
source = "registry.terraform.io/bytebase/bytebase"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/instances/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
terraform {
required_providers {
bytebase = {
version = "3.7.1"
version = "3.7.2"
# For local development, please use "terraform.local/bytebase/bytebase" instead
source = "registry.terraform.io/bytebase/bytebase"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/policies/main.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
terraform {
required_providers {
bytebase = {
version = "3.7.1"
version = "3.7.2"
# For local development, please use "terraform.local/bytebase/bytebase" instead
source = "registry.terraform.io/bytebase/bytebase"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/projects/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
terraform {
required_providers {
bytebase = {
version = "3.7.1"
version = "3.7.2"
# For local development, please use "terraform.local/bytebase/bytebase" instead
source = "registry.terraform.io/bytebase/bytebase"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/risk/main.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
terraform {
required_providers {
bytebase = {
version = "3.7.1"
version = "3.7.2"
# For local development, please use "terraform.local/bytebase/bytebase" instead
source = "registry.terraform.io/bytebase/bytebase"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/roles/main.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
terraform {
required_providers {
bytebase = {
version = "3.7.1"
version = "3.7.2"
# For local development, please use "terraform.local/bytebase/bytebase" instead
source = "registry.terraform.io/bytebase/bytebase"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/settings/main.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
terraform {
required_providers {
bytebase = {
version = "3.7.1"
version = "3.7.2"
# For local development, please use "terraform.local/bytebase/bytebase" instead
source = "registry.terraform.io/bytebase/bytebase"
}
Expand Down
3 changes: 2 additions & 1 deletion examples/setup/environment.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
resource "bytebase_setting" "environments" {
name = "ENVIRONMENT"
name = "settings/ENVIRONMENT"

environment_setting {
environment {
id = local.environment_id_prod
Expand Down
2 changes: 1 addition & 1 deletion examples/setup/main.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
terraform {
required_providers {
bytebase = {
version = "3.7.1"
version = "3.7.2"
# For local development, please use "terraform.local/bytebase/bytebase" instead
source = "registry.terraform.io/bytebase/bytebase"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/sql_review/main.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
terraform {
required_providers {
bytebase = {
version = "3.7.1"
version = "3.7.2"
# For local development, please use "terraform.local/bytebase/bytebase" instead
source = "registry.terraform.io/bytebase/bytebase"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/users/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
terraform {
required_providers {
bytebase = {
version = "3.7.1"
version = "3.7.2"
# For local development, please use "terraform.local/bytebase/bytebase" instead
source = "registry.terraform.io/bytebase/bytebase"
}
Expand Down
3 changes: 1 addition & 2 deletions provider/data_source_database_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package provider
import (
"context"
"fmt"
"regexp"

"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
Expand All @@ -29,7 +28,7 @@ func dataSourceDatabaseGroup() *schema.Resource {
Type: schema.TypeString,
Required: true,
ValidateDiagFunc: internal.ResourceNameValidation(
regexp.MustCompile(fmt.Sprintf("^%s%s$", internal.ProjectNamePrefix, internal.ResourceIDPattern)),
fmt.Sprintf("^%s%s$", internal.ProjectNamePrefix, internal.ResourceIDPattern),
),
Description: "The project fullname in projects/{id} format.",
},
Expand Down
3 changes: 1 addition & 2 deletions provider/data_source_database_group_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package provider
import (
"context"
"fmt"
"regexp"
"strconv"
"time"

Expand All @@ -23,7 +22,7 @@ func dataSourceDatabaseGroupList() *schema.Resource {
Type: schema.TypeString,
Required: true,
ValidateDiagFunc: internal.ResourceNameValidation(
regexp.MustCompile(fmt.Sprintf("^%s%s$", internal.ProjectNamePrefix, internal.ResourceIDPattern)),
fmt.Sprintf("^%s%s$", internal.ProjectNamePrefix, internal.ResourceIDPattern),
),
Description: "The project fullname in projects/{id} format.",
},
Expand Down
37 changes: 21 additions & 16 deletions provider/data_source_database_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package provider
import (
"context"
"fmt"
"regexp"
"strconv"
"time"

Expand All @@ -25,9 +24,9 @@ func dataSourceDatabaseList() *schema.Resource {
Type: schema.TypeString,
Required: true,
ValidateDiagFunc: internal.ResourceNameValidation(
regexp.MustCompile("^workspaces/-$"),
regexp.MustCompile(fmt.Sprintf("^%s%s$", internal.InstanceNamePrefix, internal.ResourceIDPattern)),
regexp.MustCompile(fmt.Sprintf("^%s%s$", internal.ProjectNamePrefix, internal.ResourceIDPattern)),
fmt.Sprintf("^%s$", internal.WorkspaceName),
fmt.Sprintf("^%s%s$", internal.InstanceNamePrefix, internal.ResourceIDPattern),
fmt.Sprintf("^%s%s$", internal.ProjectNamePrefix, internal.ResourceIDPattern),
),
},
"query": {
Expand All @@ -41,22 +40,28 @@ func dataSourceDatabaseList() *schema.Resource {
Description: "If not include unassigned databases in the response.",
},
"environment": {
Type: schema.TypeString,
Optional: true,
Description: "The environment full name. Filter databases by environment.",
ValidateDiagFunc: internal.ResourceNameValidation(regexp.MustCompile(fmt.Sprintf("^%s%s$", internal.EnvironmentNamePrefix, internal.ResourceIDPattern))),
Type: schema.TypeString,
Optional: true,
Description: "The environment full name. Filter databases by environment.",
ValidateDiagFunc: internal.ResourceNameValidation(
fmt.Sprintf("^%s%s$", internal.EnvironmentNamePrefix, internal.ResourceIDPattern),
),
},
"project": {
Type: schema.TypeString,
Optional: true,
Description: "The project full name. Filter databases by project.",
ValidateDiagFunc: internal.ResourceNameValidation(regexp.MustCompile(fmt.Sprintf("^%s%s$", internal.ProjectNamePrefix, internal.ResourceIDPattern))),
Type: schema.TypeString,
Optional: true,
Description: "The project full name. Filter databases by project.",
ValidateDiagFunc: internal.ResourceNameValidation(
fmt.Sprintf("^%s%s$", internal.ProjectNamePrefix, internal.ResourceIDPattern),
),
},
"instance": {
Type: schema.TypeString,
Optional: true,
Description: "The instance full name. Filter databases by instance.",
ValidateDiagFunc: internal.ResourceNameValidation(regexp.MustCompile(fmt.Sprintf("^%s%s$", internal.InstanceNamePrefix, internal.ResourceIDPattern))),
Type: schema.TypeString,
Optional: true,
Description: "The instance full name. Filter databases by instance.",
ValidateDiagFunc: internal.ResourceNameValidation(
fmt.Sprintf("^%s%s$", internal.InstanceNamePrefix, internal.ResourceIDPattern),
),
},
"engines": {
Type: schema.TypeSet,
Expand Down
3 changes: 1 addition & 2 deletions provider/data_source_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"bytes"
"context"
"fmt"
"regexp"

"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
Expand All @@ -24,7 +23,7 @@ func dataSourceGroup() *schema.Resource {
Type: schema.TypeString,
Required: true,
ValidateDiagFunc: internal.ResourceNameValidation(
regexp.MustCompile(fmt.Sprintf("^%s", internal.GroupNamePrefix)),
fmt.Sprintf("^%s", internal.GroupNamePrefix),
),
Description: "The group name in groups/{email} format.",
},
Expand Down
5 changes: 2 additions & 3 deletions provider/data_source_iam_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"bytes"
"context"
"fmt"
"regexp"
"strconv"
"strings"

Expand All @@ -28,9 +27,9 @@ func dataSourceIAMPolicy() *schema.Resource {
Required: true,
ValidateDiagFunc: internal.ResourceNameValidation(
// workspace policy
regexp.MustCompile("^workspaces/-$"),
fmt.Sprintf("^%s$", internal.WorkspaceName),
// project policy
regexp.MustCompile(fmt.Sprintf("^%s%s$", internal.ProjectNamePrefix, internal.ResourceIDPattern)),
fmt.Sprintf("^%s%s$", internal.ProjectNamePrefix, internal.ResourceIDPattern),
),
Description: `The IAM policy parent name for the policy, support "projects/{resource id}" or "workspaces/-"`,
},
Expand Down
21 changes: 12 additions & 9 deletions provider/data_source_instance_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package provider
import (
"context"
"fmt"
"regexp"
"strconv"
"time"

Expand All @@ -28,16 +27,20 @@ func dataSourceInstanceList() *schema.Resource {
Description: "Filter instances by name or resource id with wildcard",
},
"environment": {
Type: schema.TypeString,
Optional: true,
Description: "The environment full name. Filter instances by environment.",
ValidateDiagFunc: internal.ResourceNameValidation(regexp.MustCompile(fmt.Sprintf("^%s%s$", internal.EnvironmentNamePrefix, internal.ResourceIDPattern))),
Type: schema.TypeString,
Optional: true,
Description: "The environment full name. Filter instances by environment.",
ValidateDiagFunc: internal.ResourceNameValidation(
fmt.Sprintf("^%s%s$", internal.EnvironmentNamePrefix, internal.ResourceIDPattern),
),
},
"project": {
Type: schema.TypeString,
Optional: true,
Description: "The project full name. Filter instances by project.",
ValidateDiagFunc: internal.ResourceNameValidation(regexp.MustCompile(fmt.Sprintf("^%s%s$", internal.ProjectNamePrefix, internal.ResourceIDPattern))),
Type: schema.TypeString,
Optional: true,
Description: "The project full name. Filter instances by project.",
ValidateDiagFunc: internal.ResourceNameValidation(
fmt.Sprintf("^%s%s$", internal.ProjectNamePrefix, internal.ResourceIDPattern),
),
},
"host": {
Type: schema.TypeString,
Expand Down
11 changes: 5 additions & 6 deletions provider/data_source_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"bytes"
"context"
"fmt"
"regexp"
"strings"

"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
Expand All @@ -29,15 +28,15 @@ func dataSourcePolicy() *schema.Resource {
Default: "",
ValidateDiagFunc: internal.ResourceNameValidation(
// workspace policy
regexp.MustCompile(fmt.Sprintf("^%s$", internal.WorkspaceName)),
fmt.Sprintf("^%s$", internal.WorkspaceName),
// environment policy
regexp.MustCompile(fmt.Sprintf("^%s%s$", internal.EnvironmentNamePrefix, internal.ResourceIDPattern)),
fmt.Sprintf("^%s%s$", internal.EnvironmentNamePrefix, internal.ResourceIDPattern),
// instance policy
regexp.MustCompile(fmt.Sprintf("^%s%s$", internal.InstanceNamePrefix, internal.ResourceIDPattern)),
fmt.Sprintf("^%s%s$", internal.InstanceNamePrefix, internal.ResourceIDPattern),
// project policy
regexp.MustCompile(fmt.Sprintf("^%s%s$", internal.ProjectNamePrefix, internal.ResourceIDPattern)),
fmt.Sprintf("^%s%s$", internal.ProjectNamePrefix, internal.ResourceIDPattern),
// database policy
regexp.MustCompile(fmt.Sprintf("^%s%s/%s%s$", internal.InstanceNamePrefix, internal.ResourceIDPattern, internal.DatabaseIDPrefix, internal.ResourceIDPattern)),
fmt.Sprintf("^%s%s/%s%s$", internal.InstanceNamePrefix, internal.ResourceIDPattern, internal.DatabaseIDPrefix, internal.ResourceIDPattern),
),
Description: "The policy parent name for the policy, support projects/{resource id}, environments/{resource id}, instances/{resource id}, or instances/{resource id}/databases/{database name}",
},
Expand Down
Loading