Skip to content

Commit

Permalink
add support of postgres 18;
Browse files Browse the repository at this point in the history
refactor version validation logic.

Signed-off-by: Dmitry Kisler <admin@dkisler.com>
  • Loading branch information
kislerdm committed Sep 28, 2024
1 parent 4a0bbd2 commit 5727b14
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [v0.6.1] - 2024-09-28

### Added

- Added support of Postgres 17. See the Neon [announcement](https://neon.tech/blog/postgres-17) and the Postgres
[announcement](https://www.postgresql.org/about/news/postgresql-17-released-2936/).

## [v0.6.0] - 2024-09-23

### Added
Expand Down
13 changes: 6 additions & 7 deletions internal/provider/resource_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"errors"
"fmt"
"slices"
"strconv"
"time"

"github.com/hashicorp/terraform-plugin-log/tflog"
Expand Down Expand Up @@ -64,15 +63,15 @@ API: https://api-docs.neon.tech/reference/createproject`,
ForceNew: true,
Description: "Postgres version",
ValidateFunc: func(i interface{}, _ string) (warns []string, errs []error) {
switch v := i.(int); v {
case 14, 15, 16:
return
default:
supportedVersion := func(v int) bool { return v > 13 && v < 18 }

if v, ok := i.(int); !ok || !supportedVersion(v) {
errs = append(
errs, errors.New("postgres version "+strconv.Itoa(v)+" is not supported yet"),
errs, fmt.Errorf("postgres version %v is not supported", i),
)
return
}

return
},
},
"store_password": newStoreProjectPasswordDefault(),
Expand Down

0 comments on commit 5727b14

Please sign in to comment.