From 23f81c305346a83b0397fcb6ac07ff6e96872fc1 Mon Sep 17 00:00:00 2001 From: Murad Biashimov Date: Mon, 16 Dec 2024 15:12:32 +0100 Subject: [PATCH] fix: changelog doesn't show diff for user config enums --- CHANGELOG.md | 17 ++++++ changelog/differ.go | 41 +++++++++++---- changelog/differ_test.go | 52 ++++++++++++------- changelog/main.go | 10 ++-- changelog/text.go | 18 +++++-- changelog/types.go | 36 ++++++++----- docs/data-sources/account_team_project.md | 2 +- docs/data-sources/alloydbomni.md | 1 + docs/data-sources/opensearch.md | 1 + docs/data-sources/pg.md | 1 + docs/data-sources/project_user.md | 2 +- docs/resources/account_team_project.md | 2 +- docs/resources/alloydbomni.md | 1 + docs/resources/flink.md | 2 +- docs/resources/opensearch.md | 1 + docs/resources/organization_group_project.md | 2 +- docs/resources/organization_permission.md | 2 +- docs/resources/pg.md | 5 +- docs/resources/project_user.md | 2 +- go.mod | 4 +- go.sum | 8 +-- .../userconfig/service/alloydbomni.go | 6 +++ .../sdkprovider/userconfig/service/flink.go | 2 +- .../userconfig/service/opensearch.go | 5 ++ internal/sdkprovider/userconfig/service/pg.go | 9 +++- 25 files changed, 165 insertions(+), 67 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bfadc5a9f..8e15df4fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,23 @@ nav_order: 1 - Add `aiven_service_integration` resource field `source_service_project`: Source service project name - Add `aiven_service_integration` datasource field `destination_service_project`: Destination service project name - Add `aiven_service_integration` datasource field `source_service_project`: Source service project name +- Change `aiven_account_team_project` resource and datasource field `team_type` (enum): remove + `organization:billing:read`, `organization:billing:write`, `organization:network:read`, `organization:network:write`, + `organization:permissions:read`, `organization:permissions:write`, `organization:projects:read`, `organization:projects:write` +- Add `aiven_alloydbomni` resource and datasource field `alloydbomni_user_config.pg.password_encryption` (enum) +- Change `aiven_flink` resource and datasource field `flink_user_config.flink_version` (enum): add `1.20` +- Add `aiven_opensearch` resource and datasource field + `opensearch_user_config.opensearch_dashboards.multiple_data_source_enabled`: Enable or disable multiple data sources + in OpenSearch Dashboards +- Change `aiven_organization_permission` resource field `permissions.permissions` (enum): remove + `organization:billing:read`, `organization:billing:write`, `organization:network:read`, `organization:network:write`, + `organization:permissions:read`, `organization:permissions:write`, `organization:projects:read`, `organization:projects:write` +- Add `aiven_pg` resource and datasource field `pg_user_config.pg.password_encryption` (enum) +- Change `aiven_pg` resource and datasource field `pg_user_config.additional_backup_regions`: remove deprecation +- Change `aiven_pg` resource and datasource field `pg_user_config.pg_version` (enum): add `17` +- Change `aiven_project_user` resource and datasource field `member_type` (enum): remove `organization:billing:read`, + `organization:billing:write`, `organization:network:read`, `organization:network:write`, + `organization:permissions:read`, `organization:permissions:write`, `organization:projects:read`, `organization:projects:write` ## [4.30.0] - 2024-12-05 diff --git a/changelog/differ.go b/changelog/differ.go index d5185affa..a8f5414d6 100644 --- a/changelog/differ.go +++ b/changelog/differ.go @@ -12,7 +12,7 @@ import ( "github.com/samber/lo" ) -func diffItems(resourceType RootType, was, have *Item) (*Diff, error) { +func diffItems(was, have *Item) (*Diff, error) { // Added or removed if was == nil || have == nil { action := AddDiffAction @@ -23,8 +23,7 @@ func diffItems(resourceType RootType, was, have *Item) (*Diff, error) { return &Diff{ Action: action, - RootType: resourceType, - Description: removeEnum(have.Description), + Description: removeEnum(have.Description), // Some fields have enums in the spec description Item: have, }, nil } @@ -83,7 +82,6 @@ func diffItems(resourceType RootType, was, have *Item) (*Diff, error) { return &Diff{ Action: ChangeDiffAction, - RootType: resourceType, Description: strings.Join(entries, ", "), Item: have, }, nil @@ -91,7 +89,7 @@ func diffItems(resourceType RootType, was, have *Item) (*Diff, error) { func diffItemMaps(was, have ItemMap) ([]string, error) { result := make([]*Diff, 0) - kinds := []RootType{ResourceRootType, DataSourceRootType} + kinds := []RootKind{ResourceRootKind, DataSourceRootKind} for _, kind := range kinds { wasItems := was[kind] haveItems := have[kind] @@ -122,7 +120,7 @@ func diffItemMaps(was, have ItemMap) ([]string, error) { skipPrefix = k } - change, err := diffItems(kind, wasVal, haveVal) + change, err := diffItems(wasVal, haveVal) if err != nil { return nil, fmt.Errorf("failed to compare %s %s: %w", kind, k, err) } @@ -167,18 +165,41 @@ func toMap(item *Item) (map[string]any, error) { func serializeDiff(list []*Diff) []string { sort.Slice(list, func(i, j int) bool { a, b := list[i], list[j] + + if a.Item.Root != b.Item.Root { + return a.Item.Root < b.Item.Root + } + if a.Action != b.Action { return a.Action < b.Action } - // Resource comes first, then datasource - if a.RootType != b.RootType { - return a.RootType > b.RootType + if a.Item.Path != b.Item.Path { + return a.Item.Path < b.Item.Path + } + + if a.Item.Kind != b.Item.Kind { + return a.Item.Kind > b.Item.Kind } - return a.Item.Path < b.Item.Path + return false }) + // Removes duplicates + unique := make(map[string]*Diff) + for i := 0; i < len(list); i++ { + d := list[i] + k := fmt.Sprintf("%s:%s:%s", d.Action, d.Item.Path, d.Description) + other, ok := unique[k] + if !ok { + unique[k] = d + continue + } + other.AlsoAppliesTo = d.Item + list = append(list[:i], list[i+1:]...) + i-- + } + strs := make([]string, len(list)) for i, r := range list { strs[i] = r.String() diff --git a/changelog/differ_test.go b/changelog/differ_test.go index 4b25fc617..98df04dae 100644 --- a/changelog/differ_test.go +++ b/changelog/differ_test.go @@ -12,102 +12,116 @@ func TestCompare(t *testing.T) { tests := []struct { name string expect string - kind RootType old, new *Item }{ { name: "change enums", - expect: "Change `foo` resource field `bar`: add `foo`, remove `bar`", - kind: ResourceRootType, + expect: "Change `foo` resource field `bar` (enum): add `foo`, remove `bar`", old: &Item{ + Kind: ResourceRootKind, Type: schema.TypeString, Path: "foo.bar", + Root: "foo", Description: "Foo. The possible values are `bar`, `baz`.", }, new: &Item{ + Kind: ResourceRootKind, Type: schema.TypeString, Path: "foo.bar", + Root: "foo", Description: "Foo. The possible values are `foo`, `baz`.", }, }, { name: "change enum", - expect: "Change `foo` resource field `bar`: add `foo`", - kind: ResourceRootType, + expect: "Change `foo` resource field `bar` (enum): add `foo`", old: &Item{ + Kind: ResourceRootKind, Type: schema.TypeString, Path: "foo.bar", + Root: "foo", Description: "Foo. The possible values is `bar`", }, new: &Item{ + Kind: ResourceRootKind, Type: schema.TypeString, Path: "foo.bar", + Root: "foo", Description: "Foo. The possible values are `foo`, `bar`.", }, }, { name: "add resource field", expect: "Add `foo` resource field `bar`: Foo", - kind: ResourceRootType, new: &Item{ + Kind: ResourceRootKind, Type: schema.TypeString, Path: "foo.bar", + Root: "foo", Description: "Foo", }, }, { name: "remove resource field", expect: "Remove `foo` resource field `bar`: Foo", - kind: ResourceRootType, old: &Item{ + Kind: ResourceRootKind, Type: schema.TypeString, Path: "foo.bar", + Root: "foo", Description: "Foo", }, }, { name: "remove beta from the field", expect: "Change `foo` resource field `bar`: no longer beta", - kind: ResourceRootType, old: &Item{ + Kind: ResourceRootKind, Type: schema.TypeString, Path: "foo.bar", + Root: "foo", Description: "PROVIDER_AIVEN_ENABLE_BETA", }, new: &Item{ + Kind: ResourceRootKind, Type: schema.TypeString, Path: "foo.bar", + Root: "foo", Description: "Foo", }, }, { name: "add beta resource", expect: "Add `foo` resource _(beta)_: does stuff, PROVIDER_AIVEN_ENABLE_BETA", - kind: ResourceRootType, new: &Item{ + Kind: ResourceRootKind, Type: schema.TypeString, Path: "foo", + Root: "foo", Description: "does stuff, PROVIDER_AIVEN_ENABLE_BETA", }, }, { name: "change type", expect: "Change `foo` resource field `bar`: type ~~`list`~~ → `set`", - kind: ResourceRootType, old: &Item{ + Kind: ResourceRootKind, Type: schema.TypeList, Path: "foo.bar", + Root: "foo", }, new: &Item{ + Kind: ResourceRootKind, Type: schema.TypeSet, Path: "foo.bar", + Root: "foo", }, }, } for _, opt := range tests { t.Run(opt.name, func(t *testing.T) { - got, err := diffItems(opt.kind, opt.old, opt.new) + got, err := diffItems(opt.old, opt.new) assert.NoError(t, err) assert.Equal(t, opt.expect, got.String()) }) @@ -116,19 +130,19 @@ func TestCompare(t *testing.T) { func TestSerializeDiff(t *testing.T) { list := []*Diff{ - {Action: AddDiffAction, RootType: ResourceRootType, Description: "foo", Item: &Item{Path: "aiven_opensearch.opensearch_user_config.azure_migration.include_aliases"}}, - {Action: ChangeDiffAction, RootType: DataSourceRootType, Description: "remove deprecation", Item: &Item{Path: "aiven_cassandra.cassandra_user_config.additional_backup_regions"}}, - {Action: ChangeDiffAction, RootType: ResourceRootType, Description: "remove deprecation", Item: &Item{Path: "aiven_cassandra.cassandra_user_config.additional_backup_regions"}}, - {Action: AddDiffAction, RootType: ResourceRootType, Description: "foo", Item: &Item{Path: "aiven_opensearch.opensearch_user_config.s3_migration.include_aliases"}}, - {Action: AddDiffAction, RootType: ResourceRootType, Description: "foo", Item: &Item{Path: "aiven_opensearch.opensearch_user_config.gcs_migration.include_aliases"}}, + {Action: AddDiffAction, Description: "foo", Item: &Item{Kind: ResourceRootKind, Root: "aiven_opensearch", Path: "aiven_opensearch.opensearch_user_config.azure_migration.include_aliases"}}, + {Action: ChangeDiffAction, Description: "remove deprecation", Item: &Item{Kind: DataSourceRootKind, Root: "aiven_cassandra", Path: "aiven_cassandra.cassandra_user_config.additional_backup_regions"}}, + {Action: ChangeDiffAction, Description: "remove deprecation", Item: &Item{Kind: ResourceRootKind, Root: "aiven_cassandra", Path: "aiven_cassandra.cassandra_user_config.additional_backup_regions"}}, + {Action: AddDiffAction, Description: "foo", Item: &Item{Kind: ResourceRootKind, Root: "aiven_opensearch", Path: "aiven_opensearch.opensearch_user_config.s3_migration.include_aliases"}}, + {Action: AddDiffAction, Description: "foo", Item: &Item{Kind: DataSourceRootKind, Root: "aiven_opensearch", Path: "aiven_opensearch.opensearch_user_config.s3_migration.include_aliases"}}, + {Action: AddDiffAction, Description: "foo", Item: &Item{Kind: ResourceRootKind, Root: "aiven_opensearch", Path: "aiven_opensearch.opensearch_user_config.gcs_migration.include_aliases"}}, } expect := []string{ + "Change `aiven_cassandra` resource and datasource field `cassandra_user_config.additional_backup_regions`: remove deprecation", "Add `aiven_opensearch` resource field `opensearch_user_config.azure_migration.include_aliases`: foo", "Add `aiven_opensearch` resource field `opensearch_user_config.gcs_migration.include_aliases`: foo", - "Add `aiven_opensearch` resource field `opensearch_user_config.s3_migration.include_aliases`: foo", - "Change `aiven_cassandra` resource field `cassandra_user_config.additional_backup_regions`: remove deprecation", - "Change `aiven_cassandra` datasource field `cassandra_user_config.additional_backup_regions`: remove deprecation", + "Add `aiven_opensearch` resource and datasource field `opensearch_user_config.s3_migration.include_aliases`: foo", } actual := serializeDiff(list) diff --git a/changelog/main.go b/changelog/main.go index c3e145c9b..8bc3de768 100644 --- a/changelog/main.go +++ b/changelog/main.go @@ -162,9 +162,9 @@ func writeChangelog(filePath string, reformat bool, entries []string) error { func fromProvider(p *schema.Provider) (ItemMap, error) { // Item names might clash between resources and data sources // Splits into separate maps - sourceMaps := map[RootType]map[string]*schema.Resource{ - ResourceRootType: p.ResourcesMap, - DataSourceRootType: p.DataSourcesMap, + sourceMaps := map[RootKind]map[string]*schema.Resource{ + ResourceRootKind: p.ResourcesMap, + DataSourceRootKind: p.DataSourcesMap, } items := make(ItemMap) @@ -173,7 +173,9 @@ func fromProvider(p *schema.Provider) (ItemMap, error) { for name, r := range m { res := &Item{ Name: name, + Root: name, Path: name, + Kind: kind, Description: r.Description, Type: schema.TypeList, } @@ -192,7 +194,9 @@ func fromProvider(p *schema.Provider) (ItemMap, error) { func walkSchema(name string, this *schema.Schema, parent *Item) []*Item { item := &Item{ Name: name, + Root: parent.Root, Path: fmt.Sprintf("%s.%s", parent.Path, name), + Kind: parent.Kind, ForceNew: this.ForceNew, Optional: this.Optional, Sensitive: this.Sensitive, diff --git a/changelog/text.go b/changelog/text.go index f268dd8f0..559e48b55 100644 --- a/changelog/text.go +++ b/changelog/text.go @@ -25,11 +25,21 @@ func removeEnum(text string) string { var reCode = regexp.MustCompile("`([^`]+)`") func findEnums(description string) []string { - parts := strings.Split(description, userconfig.PossibleValuesPrefix) - if len(parts) != 2 { - return nil + var values []string + switch { + case strings.Contains(description, userconfig.PossibleValuesPrefix): + // userconfig.PossibleValuesPrefix is used within "internal" pacakge, + // see userconfig.DescriptionBuilder.PossibleValuesString() + parts := strings.Split(description, userconfig.PossibleValuesPrefix) + if len(parts) != 2 { + return nil + } + values = reCode.FindAllString(parts[1], -1) + case strings.Contains(strings.ToLower(description), "enum"): + // "enum" is used in the user config generator + values = reCode.FindAllString(description, -1) } - values := reCode.FindAllString(parts[1], -1) + if len(values) == 0 { return nil } diff --git a/changelog/types.go b/changelog/types.go index e27ddae8b..14c1abc8d 100644 --- a/changelog/types.go +++ b/changelog/types.go @@ -7,11 +7,11 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -type RootType string +type RootKind string const ( - ResourceRootType RootType = "resource" - DataSourceRootType RootType = "datasource" + ResourceRootKind RootKind = "resource" + DataSourceRootKind RootKind = "datasource" ) type DiffAction string @@ -22,11 +22,13 @@ const ( ChangeDiffAction DiffAction = "Change" ) -type ItemMap map[RootType]map[string]*Item +type ItemMap map[RootKind]map[string]*Item type Item struct { - Path string `json:"path"` // e.g. aiven_project.project - Name string `json:"name"` // e.g. project + Name string `json:"name"` // e.g. project + Root string `json:"root"` // e.g. aiven_project + Path string `json:"path"` // e.g. aiven_project.project + Kind RootKind `json:"kind"` // e.g. resource or datasource // Terraform schema fields Description string `json:"description"` @@ -40,22 +42,30 @@ type Item struct { } type Diff struct { - Action DiffAction - RootType RootType - Description string - Item *Item + Action DiffAction + Item *Item + AlsoAppliesTo *Item // e.g., when the change is same for resource and datasource + Description string } func (c *Diff) String() string { - // resource name + field name - path := strings.SplitN(c.Item.Path, ".", 2) + // Often the same diff applies both for resource and datasource + kinds := make([]string, 0, 2) + kinds = append(kinds, string(c.Item.Kind)) + if c.AlsoAppliesTo != nil { + kinds = append(kinds, string(c.AlsoAppliesTo.Kind)) + } // e.g.: "Add `aiven_project` resource" - msg := fmt.Sprintf("%s `%s` %s", c.Action, path[0], c.RootType) + path := strings.SplitN(c.Item.Path, ".", 2) + msg := fmt.Sprintf("%s `%s` %s", c.Action, path[0], strings.Join(kinds, " and ")) // e.g.: "field `project`" if len(path) > 1 { msg = fmt.Sprintf("%s field `%s`", msg, path[1]) + if len(findEnums(c.Item.Description)) > 0 { + msg += " (enum)" + } } // Adds beta if needed diff --git a/docs/data-sources/account_team_project.md b/docs/data-sources/account_team_project.md index b9418a468..4dcc54d51 100644 --- a/docs/data-sources/account_team_project.md +++ b/docs/data-sources/account_team_project.md @@ -32,4 +32,4 @@ data "aiven_account_team_project" "account_team_project1" { ### Read-Only - `id` (String) The ID of this resource. -- `team_type` (String) The Account team project type. The possible values are `admin`, `operator`, `developer`, `read_only`, `project:integrations:read`, `project:integrations:write`, `project:networking:read`, `project:networking:write`, `project:permissions:read`, `service:configuration:write`, `service:logs:read`, `project:services:read`, `project:services:write`, `project:audit_logs:read`, `service:data:write`, `service:secrets:read`, `role:services:maintenance`, `role:services:recover`, `organization:billing:read`, `organization:billing:write`, `organization:audit_logs:read`, `organization:projects:read`, `organization:projects:write`, `organization:users:write`, `organization:permissions:read`, `organization:permissions:write`, `organization:app_users:write`, `organization:groups:write`, `organization:idps:write`, `organization:domains:write`, `organization:network:read`, `organization:network:write`, `role:organization:admin` and `service:users:write`. +- `team_type` (String) The Account team project type. The possible values are `admin`, `operator`, `developer`, `read_only`, `project:integrations:read`, `project:integrations:write`, `project:networking:read`, `project:networking:write`, `project:permissions:read`, `service:configuration:write`, `service:logs:read`, `project:services:read`, `project:services:write`, `project:audit_logs:read`, `service:data:write`, `service:secrets:read`, `service:users:write`, `role:services:maintenance`, `role:services:recover`, `organization:audit_logs:read`, `organization:users:write`, `organization:app_users:write`, `organization:groups:write`, `organization:idps:write`, `organization:domains:write` and `role:organization:admin`. diff --git a/docs/data-sources/alloydbomni.md b/docs/data-sources/alloydbomni.md index 3ba12f275..4ebaee6ed 100644 --- a/docs/data-sources/alloydbomni.md +++ b/docs/data-sources/alloydbomni.md @@ -176,6 +176,7 @@ Read-Only: - `max_standby_streaming_delay` (Number) - `max_wal_senders` (Number) - `max_worker_processes` (Number) +- `password_encryption` (String) - `pg_partman_bgw__dot__interval` (Number) - `pg_partman_bgw__dot__role` (String) - `pg_stat_statements__dot__track` (String) diff --git a/docs/data-sources/opensearch.md b/docs/data-sources/opensearch.md index d3ea5d128..690426c4e 100644 --- a/docs/data-sources/opensearch.md +++ b/docs/data-sources/opensearch.md @@ -448,6 +448,7 @@ Read-Only: - `enabled` (Boolean) - `max_old_space_size` (Number) +- `multiple_data_source_enabled` (Boolean) - `opensearch_request_timeout` (Number) diff --git a/docs/data-sources/pg.md b/docs/data-sources/pg.md index ac5b9d4a7..06b6abbb8 100644 --- a/docs/data-sources/pg.md +++ b/docs/data-sources/pg.md @@ -210,6 +210,7 @@ Read-Only: - `max_standby_streaming_delay` (Number) - `max_wal_senders` (Number) - `max_worker_processes` (Number) +- `password_encryption` (String) - `pg_partman_bgw__dot__interval` (Number) - `pg_partman_bgw__dot__role` (String) - `pg_stat_monitor__dot__pgsm_enable_query_plan` (Boolean) diff --git a/docs/data-sources/project_user.md b/docs/data-sources/project_user.md index 09a1c8d01..72e44b36b 100644 --- a/docs/data-sources/project_user.md +++ b/docs/data-sources/project_user.md @@ -31,4 +31,4 @@ data "aiven_project_user" "mytestuser" { - `accepted` (Boolean) Whether the user has accepted the request to join the project. Users get an invite and become project members after accepting the invite. - `id` (String) The ID of this resource. -- `member_type` (String) Project membership type. The possible values are `admin`, `developer`, `operator`, `organization:app_users:write`, `organization:audit_logs:read`, `organization:billing:read`, `organization:billing:write`, `organization:domains:write`, `organization:groups:write`, `organization:idps:write`, `organization:network:read`, `organization:network:write`, `organization:permissions:read`, `organization:permissions:write`, `organization:projects:read`, `organization:projects:write`, `organization:users:write`, `project:audit_logs:read`, `project:integrations:read`, `project:integrations:write`, `project:networking:read`, `project:networking:write`, `project:permissions:read`, `project:services:read`, `project:services:write`, `read_only`, `role:organization:admin`, `role:services:maintenance`, `role:services:recover`, `service:configuration:write`, `service:data:write`, `service:logs:read`, `service:secrets:read` and `service:users:write`. +- `member_type` (String) Project membership type. The possible values are `admin`, `developer`, `operator`, `organization:app_users:write`, `organization:audit_logs:read`, `organization:domains:write`, `organization:groups:write`, `organization:idps:write`, `organization:users:write`, `project:audit_logs:read`, `project:integrations:read`, `project:integrations:write`, `project:networking:read`, `project:networking:write`, `project:permissions:read`, `project:services:read`, `project:services:write`, `read_only`, `role:organization:admin`, `role:services:maintenance`, `role:services:recover`, `service:configuration:write`, `service:data:write`, `service:logs:read`, `service:secrets:read` and `service:users:write`. diff --git a/docs/resources/account_team_project.md b/docs/resources/account_team_project.md index 7ffc6be38..b321e822e 100644 --- a/docs/resources/account_team_project.md +++ b/docs/resources/account_team_project.md @@ -48,7 +48,7 @@ resource "aiven_account_team_project" "main" { ### Optional - `project_name` (String) The name of an already existing project -- `team_type` (String) The Account team project type. The possible values are `admin`, `operator`, `developer`, `read_only`, `project:integrations:read`, `project:integrations:write`, `project:networking:read`, `project:networking:write`, `project:permissions:read`, `service:configuration:write`, `service:logs:read`, `project:services:read`, `project:services:write`, `project:audit_logs:read`, `service:data:write`, `service:secrets:read`, `role:services:maintenance`, `role:services:recover`, `organization:billing:read`, `organization:billing:write`, `organization:audit_logs:read`, `organization:projects:read`, `organization:projects:write`, `organization:users:write`, `organization:permissions:read`, `organization:permissions:write`, `organization:app_users:write`, `organization:groups:write`, `organization:idps:write`, `organization:domains:write`, `organization:network:read`, `organization:network:write`, `role:organization:admin` and `service:users:write`. +- `team_type` (String) The Account team project type. The possible values are `admin`, `operator`, `developer`, `read_only`, `project:integrations:read`, `project:integrations:write`, `project:networking:read`, `project:networking:write`, `project:permissions:read`, `service:configuration:write`, `service:logs:read`, `project:services:read`, `project:services:write`, `project:audit_logs:read`, `service:data:write`, `service:secrets:read`, `service:users:write`, `role:services:maintenance`, `role:services:recover`, `organization:audit_logs:read`, `organization:users:write`, `organization:app_users:write`, `organization:groups:write`, `organization:idps:write`, `organization:domains:write` and `role:organization:admin`. - `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts)) ### Read-Only diff --git a/docs/resources/alloydbomni.md b/docs/resources/alloydbomni.md index 7d4de82d9..c99cfe2b3 100644 --- a/docs/resources/alloydbomni.md +++ b/docs/resources/alloydbomni.md @@ -186,6 +186,7 @@ Optional: - `max_standby_streaming_delay` (Number) Max standby streaming delay in milliseconds. - `max_wal_senders` (Number) PostgreSQL maximum WAL senders. - `max_worker_processes` (Number) Sets the maximum number of background processes that the system can support. +- `password_encryption` (String) Enum: `md5`, `scram-sha-256`. Chooses the algorithm for encrypting passwords. Default: `md5`. - `pg_partman_bgw__dot__interval` (Number) Sets the time interval to run pg_partman's scheduled tasks. Example: `3600`. - `pg_partman_bgw__dot__role` (String) Controls which role to use for pg_partman's scheduled background tasks. Example: `myrolename`. - `pg_stat_statements__dot__track` (String) Enum: `all`, `none`, `top`. Controls which statements are counted. Specify top to track top-level statements (those issued directly by clients), all to also track nested statements (such as statements invoked within functions), or none to disable statement statistics collection. The default value is top. diff --git a/docs/resources/flink.md b/docs/resources/flink.md index 38a410c4e..b4edd3b11 100644 --- a/docs/resources/flink.md +++ b/docs/resources/flink.md @@ -83,7 +83,7 @@ Optional: Optional: - `additional_backup_regions` (List of String, Deprecated) Additional Cloud Regions for Backup Replication. -- `flink_version` (String) Enum: `1.16`, `1.19`, and newer. Flink major version. +- `flink_version` (String) Enum: `1.16`, `1.19`, `1.20`, and newer. Flink major version. - `ip_filter` (Set of String, Deprecated) Allow incoming connections from CIDR address block, e.g. `10.20.0.0/16`. - `ip_filter_object` (Block Set, Max: 1024) Allow incoming connections from CIDR address block, e.g. `10.20.0.0/16` (see [below for nested schema](#nestedblock--flink_user_config--ip_filter_object)) - `ip_filter_string` (Set of String) Allow incoming connections from CIDR address block, e.g. `10.20.0.0/16`. diff --git a/docs/resources/opensearch.md b/docs/resources/opensearch.md index c503c3c1d..2ef982315 100644 --- a/docs/resources/opensearch.md +++ b/docs/resources/opensearch.md @@ -491,6 +491,7 @@ Optional: - `enabled` (Boolean) Enable or disable OpenSearch Dashboards. Default: `true`. - `max_old_space_size` (Number) Limits the maximum amount of memory (in MiB) the OpenSearch Dashboards process can use. This sets the max_old_space_size option of the nodejs running the OpenSearch Dashboards. Note: the memory reserved by OpenSearch Dashboards is not available for OpenSearch. Default: `128`. +- `multiple_data_source_enabled` (Boolean) Enable or disable multiple data sources in OpenSearch Dashboards. Default: `true`. - `opensearch_request_timeout` (Number) Timeout in milliseconds for requests made by OpenSearch Dashboards towards OpenSearch. Default: `30000`. diff --git a/docs/resources/organization_group_project.md b/docs/resources/organization_group_project.md index 8256f2832..8b817cd87 100644 --- a/docs/resources/organization_group_project.md +++ b/docs/resources/organization_group_project.md @@ -51,7 +51,7 @@ resource "aiven_organization_group_project" "example" { - `group_id` (String) The ID of the user group. - `project` (String) The project that the users in the group are members of. -- `role` (String) [Project-level role](https://aiven.io/docs/platform/reference/project-member-privileges) assigned to all users in the group. The possible values are `admin`, `operator`, `developer`, `read_only`, `project:integrations:read`, `project:integrations:write`, `project:networking:read`, `project:networking:write`, `project:permissions:read`, `service:configuration:write`, `service:logs:read`, `project:services:read`, `project:services:write`, `project:audit_logs:read`, `service:data:write`, `service:secrets:read`, `role:services:maintenance`, `role:services:recover`, `organization:billing:read`, `organization:billing:write`, `organization:audit_logs:read`, `organization:projects:read`, `organization:projects:write`, `organization:users:write`, `organization:permissions:read`, `organization:permissions:write`, `organization:app_users:write`, `organization:groups:write`, `organization:idps:write`, `organization:domains:write`, `organization:network:read`, `organization:network:write`, `role:organization:admin` and `service:users:write`. +- `role` (String) [Project-level role](https://aiven.io/docs/platform/reference/project-member-privileges) assigned to all users in the group. The possible values are `admin`, `operator`, `developer`, `read_only`, `project:integrations:read`, `project:integrations:write`, `project:networking:read`, `project:networking:write`, `project:permissions:read`, `service:configuration:write`, `service:logs:read`, `project:services:read`, `project:services:write`, `project:audit_logs:read`, `service:data:write`, `service:secrets:read`, `service:users:write`, `role:services:maintenance`, `role:services:recover`, `organization:audit_logs:read`, `organization:users:write`, `organization:app_users:write`, `organization:groups:write`, `organization:idps:write`, `organization:domains:write` and `role:organization:admin`. ### Optional diff --git a/docs/resources/organization_permission.md b/docs/resources/organization_permission.md index e78a56fc1..2d723483f 100644 --- a/docs/resources/organization_permission.md +++ b/docs/resources/organization_permission.md @@ -62,7 +62,7 @@ resource "aiven_organization_permission" "example_permissions" { Required: -- `permissions` (Set of String) List of [roles and permissions](https://aiven.io/docs/platform/concepts/permissions) to grant. The possible values are `admin`, `developer`, `operator`, `organization:app_users:write`, `organization:audit_logs:read`, `organization:billing:read`, `organization:billing:write`, `organization:domains:write`, `organization:groups:write`, `organization:idps:write`, `organization:network:read`, `organization:network:write`, `organization:permissions:read`, `organization:permissions:write`, `organization:projects:read`, `organization:projects:write`, `organization:users:write`, `project:audit_logs:read`, `project:integrations:read`, `project:integrations:write`, `project:networking:read`, `project:networking:write`, `project:permissions:read`, `project:services:read`, `project:services:write`, `read_only`, `role:organization:admin`, `role:services:maintenance`, `role:services:recover`, `service:configuration:write`, `service:data:write`, `service:logs:read`, `service:secrets:read` and `service:users:write`. +- `permissions` (Set of String) List of [roles and permissions](https://aiven.io/docs/platform/concepts/permissions) to grant. The possible values are `admin`, `developer`, `operator`, `organization:app_users:write`, `organization:audit_logs:read`, `organization:domains:write`, `organization:groups:write`, `organization:idps:write`, `organization:users:write`, `project:audit_logs:read`, `project:integrations:read`, `project:integrations:write`, `project:networking:read`, `project:networking:write`, `project:permissions:read`, `project:services:read`, `project:services:write`, `read_only`, `role:organization:admin`, `role:services:maintenance`, `role:services:recover`, `service:configuration:write`, `service:data:write`, `service:logs:read`, `service:secrets:read` and `service:users:write`. - `principal_id` (String) ID of the user or group to grant permissions to. Only active users who have accepted an [invite](https://aiven.io/docs/platform/howto/manage-org-users) to join the organization can be granted permissions. - `principal_type` (String) The type of principal. The possible values are `user` and `user_group`. diff --git a/docs/resources/pg.md b/docs/resources/pg.md index 545d92de2..a969c8a89 100644 --- a/docs/resources/pg.md +++ b/docs/resources/pg.md @@ -133,7 +133,7 @@ Read-Only: Optional: -- `additional_backup_regions` (List of String, Deprecated) Additional Cloud Regions for Backup Replication. +- `additional_backup_regions` (List of String) Additional Cloud Regions for Backup Replication. - `admin_password` (String, Sensitive) Custom password for admin user. Defaults to random string. This must be set only when a new service is being created. - `admin_username` (String) Custom username for admin user. This must be set only when a new service is being created. Example: `avnadmin`. - `backup_hour` (Number) The hour of day (in UTC) when backup for the service is started. New backup is only started if previous backup has already completed. Example: `3`. @@ -148,7 +148,7 @@ Optional: - `pg_read_replica` (Boolean) Should the service which is being forked be a read replica (deprecated, use read_replica service integration instead). - `pg_service_to_fork_from` (String) Name of the PG Service from which to fork (deprecated, use service_to_fork_from). This has effect only when a new service is being created. Example: `anotherservicename`. - `pg_stat_monitor_enable` (Boolean) Enable the pg_stat_monitor extension. Enabling this extension will cause the cluster to be restarted.When this extension is enabled, pg_stat_statements results for utility commands are unreliable. Default: `false`. -- `pg_version` (String) Enum: `10`, `11`, `12`, `13`, `14`, `15`, `16`, and newer. PostgreSQL major version. +- `pg_version` (String) Enum: `10`, `11`, `12`, `13`, `14`, `15`, `16`, `17`, and newer. PostgreSQL major version. - `pgaudit` (Block List, Max: 1, Deprecated) System-wide settings for the pgaudit extension (see [below for nested schema](#nestedblock--pg_user_config--pgaudit)) - `pgbouncer` (Block List, Max: 1) PGBouncer connection pooling settings (see [below for nested schema](#nestedblock--pg_user_config--pgbouncer)) - `pglookout` (Block List, Max: 1) System-wide settings for pglookout (see [below for nested schema](#nestedblock--pg_user_config--pglookout)) @@ -238,6 +238,7 @@ Optional: - `max_standby_streaming_delay` (Number) Max standby streaming delay in milliseconds. - `max_wal_senders` (Number) PostgreSQL maximum WAL senders. - `max_worker_processes` (Number) Sets the maximum number of background processes that the system can support. +- `password_encryption` (String) Enum: `md5`, `scram-sha-256`. Chooses the algorithm for encrypting passwords. Default: `md5`. - `pg_partman_bgw__dot__interval` (Number) Sets the time interval to run pg_partman's scheduled tasks. Example: `3600`. - `pg_partman_bgw__dot__role` (String) Controls which role to use for pg_partman's scheduled background tasks. Example: `myrolename`. - `pg_stat_monitor__dot__pgsm_enable_query_plan` (Boolean) Enables or disables query plan monitoring. diff --git a/docs/resources/project_user.md b/docs/resources/project_user.md index 2933074a4..34b6bdae4 100644 --- a/docs/resources/project_user.md +++ b/docs/resources/project_user.md @@ -33,7 +33,7 @@ resource "aiven_project_user" "mytestuser" { ### Required - `email` (String) Email address of the user in lowercase. Changing this property forces recreation of the resource. -- `member_type` (String) Project membership type. The possible values are `admin`, `developer`, `operator`, `organization:app_users:write`, `organization:audit_logs:read`, `organization:billing:read`, `organization:billing:write`, `organization:domains:write`, `organization:groups:write`, `organization:idps:write`, `organization:network:read`, `organization:network:write`, `organization:permissions:read`, `organization:permissions:write`, `organization:projects:read`, `organization:projects:write`, `organization:users:write`, `project:audit_logs:read`, `project:integrations:read`, `project:integrations:write`, `project:networking:read`, `project:networking:write`, `project:permissions:read`, `project:services:read`, `project:services:write`, `read_only`, `role:organization:admin`, `role:services:maintenance`, `role:services:recover`, `service:configuration:write`, `service:data:write`, `service:logs:read`, `service:secrets:read` and `service:users:write`. +- `member_type` (String) Project membership type. The possible values are `admin`, `developer`, `operator`, `organization:app_users:write`, `organization:audit_logs:read`, `organization:domains:write`, `organization:groups:write`, `organization:idps:write`, `organization:users:write`, `project:audit_logs:read`, `project:integrations:read`, `project:integrations:write`, `project:networking:read`, `project:networking:write`, `project:permissions:read`, `project:services:read`, `project:services:write`, `read_only`, `role:organization:admin`, `role:services:maintenance`, `role:services:recover`, `service:configuration:write`, `service:data:write`, `service:logs:read`, `service:secrets:read` and `service:users:write`. - `project` (String) The name of the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource. ### Optional diff --git a/go.mod b/go.mod index e4150bf2d..9b1223e4e 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.23 require ( github.com/aiven/aiven-go-client/v2 v2.33.0 - github.com/aiven/go-client-codegen v0.63.0 + github.com/aiven/go-client-codegen v0.68.0 github.com/avast/retry-go v3.0.0+incompatible github.com/dave/jennifer v1.7.1 github.com/docker/go-units v0.5.0 @@ -63,7 +63,7 @@ require ( cloud.google.com/go v0.112.0 // indirect cloud.google.com/go/storage v1.36.0 // indirect github.com/agext/levenshtein v1.2.3 // indirect - github.com/aiven/go-api-schemas v1.104.0 + github.com/aiven/go-api-schemas v1.106.0 github.com/aws/aws-sdk-go v1.44.122 // indirect github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect github.com/davecgh/go-spew v1.1.1 // indirect diff --git a/go.sum b/go.sum index 2c9ebc79d..f69aade45 100644 --- a/go.sum +++ b/go.sum @@ -197,10 +197,10 @@ github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7l github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= github.com/aiven/aiven-go-client/v2 v2.33.0 h1:7hsM3/2lVog/P9ls/gLeba5feNVQjK8rIL+lbxD2GB4= github.com/aiven/aiven-go-client/v2 v2.33.0/go.mod h1:qXBgER0dtjJa1V3l7kzpizuAGjFCkgahhHL5OpoM2ZM= -github.com/aiven/go-api-schemas v1.104.0 h1:RHhPLLnEXzcOwUlK7vZWcflzHcYK7LUF66koJiYbWVM= -github.com/aiven/go-api-schemas v1.104.0/go.mod h1:z7dGvufm6If4gOdVr7dWTuFZmll9FOZr5Z5CSxGpebA= -github.com/aiven/go-client-codegen v0.63.0 h1:pgs7MEgHTbEaGpjzanQ9Zty/J9SEwKQBbhwfPTY175c= -github.com/aiven/go-client-codegen v0.63.0/go.mod h1:QKN/GgLMGWd6+gPEucXlZPi5vC3C6RpD3UeBRQOLI1Y= +github.com/aiven/go-api-schemas v1.106.0 h1:qncRsbiaGnU9JE9fmTFHclTCBem+t+6EPMXGXM35w2c= +github.com/aiven/go-api-schemas v1.106.0/go.mod h1:z7dGvufm6If4gOdVr7dWTuFZmll9FOZr5Z5CSxGpebA= +github.com/aiven/go-client-codegen v0.68.0 h1:LeQC5MpbTqNxnMqtjKf0vB70VaUews+cub6gSGO2JUw= +github.com/aiven/go-client-codegen v0.68.0/go.mod h1:QKN/GgLMGWd6+gPEucXlZPi5vC3C6RpD3UeBRQOLI1Y= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM= github.com/apparentlymart/go-textseg v1.0.0/go.mod h1:z96Txxhf3xSFMPmb5X/1W05FF/Nj9VFpLOpjS5yuumk= diff --git a/internal/sdkprovider/userconfig/service/alloydbomni.go b/internal/sdkprovider/userconfig/service/alloydbomni.go index 1b7a40018..3f9812b7f 100644 --- a/internal/sdkprovider/userconfig/service/alloydbomni.go +++ b/internal/sdkprovider/userconfig/service/alloydbomni.go @@ -292,6 +292,12 @@ func alloydbomniUserConfig() *schema.Schema { Optional: true, Type: schema.TypeInt, }, + "password_encryption": { + Description: "Enum: `md5`, `scram-sha-256`. Chooses the algorithm for encrypting passwords. Default: `md5`.", + Optional: true, + Type: schema.TypeString, + ValidateFunc: validation.StringInSlice([]string{"md5", "scram-sha-256"}, false), + }, "pg_partman_bgw__dot__interval": { Description: "Sets the time interval to run pg_partman's scheduled tasks. Example: `3600`.", Optional: true, diff --git a/internal/sdkprovider/userconfig/service/flink.go b/internal/sdkprovider/userconfig/service/flink.go index 2345a2da1..15f5ba2b5 100644 --- a/internal/sdkprovider/userconfig/service/flink.go +++ b/internal/sdkprovider/userconfig/service/flink.go @@ -25,7 +25,7 @@ func flinkUserConfig() *schema.Schema { Type: schema.TypeList, }, "flink_version": { - Description: "Enum: `1.16`, `1.19`, and newer. Flink major version.", + Description: "Enum: `1.16`, `1.19`, `1.20`, and newer. Flink major version.", ForceNew: true, Optional: true, Type: schema.TypeString, diff --git a/internal/sdkprovider/userconfig/service/opensearch.go b/internal/sdkprovider/userconfig/service/opensearch.go index bce0c33b3..f92ab3e80 100644 --- a/internal/sdkprovider/userconfig/service/opensearch.go +++ b/internal/sdkprovider/userconfig/service/opensearch.go @@ -977,6 +977,11 @@ func opensearchUserConfig() *schema.Schema { Optional: true, Type: schema.TypeInt, }, + "multiple_data_source_enabled": { + Description: "Enable or disable multiple data sources in OpenSearch Dashboards. Default: `true`.", + Optional: true, + Type: schema.TypeBool, + }, "opensearch_request_timeout": { Description: "Timeout in milliseconds for requests made by OpenSearch Dashboards towards OpenSearch. Default: `30000`.", Optional: true, diff --git a/internal/sdkprovider/userconfig/service/pg.go b/internal/sdkprovider/userconfig/service/pg.go index 6e84bd060..897a26eed 100644 --- a/internal/sdkprovider/userconfig/service/pg.go +++ b/internal/sdkprovider/userconfig/service/pg.go @@ -15,7 +15,6 @@ func pgUserConfig() *schema.Schema { DiffSuppressFunc: diff.SuppressUnchanged, Elem: &schema.Resource{Schema: map[string]*schema.Schema{ "additional_backup_regions": { - Deprecated: "This property is deprecated.", Description: "Additional Cloud Regions for Backup Replication.", Elem: &schema.Schema{ Description: "Target cloud. Example: `aws-eu-central-1`.", @@ -333,6 +332,12 @@ func pgUserConfig() *schema.Schema { Optional: true, Type: schema.TypeInt, }, + "password_encryption": { + Description: "Enum: `md5`, `scram-sha-256`. Chooses the algorithm for encrypting passwords. Default: `md5`.", + Optional: true, + Type: schema.TypeString, + ValidateFunc: validation.StringInSlice([]string{"md5", "scram-sha-256"}, false), + }, "pg_partman_bgw__dot__interval": { Description: "Sets the time interval to run pg_partman's scheduled tasks. Example: `3600`.", Optional: true, @@ -463,7 +468,7 @@ func pgUserConfig() *schema.Schema { Type: schema.TypeBool, }, "pg_version": { - Description: "Enum: `10`, `11`, `12`, `13`, `14`, `15`, `16`, and newer. PostgreSQL major version.", + Description: "Enum: `10`, `11`, `12`, `13`, `14`, `15`, `16`, `17`, and newer. PostgreSQL major version.", Optional: true, Type: schema.TypeString, },