Skip to content

Commit

Permalink
Merge pull request #9 from CrunchyData/0.2_update
Browse files Browse the repository at this point in the history
0.2 update
  • Loading branch information
wilybrace authored Jun 18, 2024
2 parents cd6d7a1 + 80a23bc commit b5c1488
Show file tree
Hide file tree
Showing 23 changed files with 46 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version.txt
bin
terraform-provider-crunchybridge

.vscode
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
## 0.2.0
* Updates PostgreSQL default version to 16
* Raises minimum PostgreSQL version to 14
* Adds support for Hobby-0 plans
* Removes requirement for application_id configuration


## 0.1.0 (Initial release)

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ TEST?=$$(go list ./... | grep -v 'vendor')
HOST=github.com
NAME=crunchybridge
BINARY=terraform-provider-crunchybridge
TAG_VER?=0.1.0
TAG_VER?=0.2.0
RELTEMPDIR?=release_tmp
CMD_SHA256SUM?="sha256sum" # sometimes 'shasum -a 256'

Expand Down
2 changes: 1 addition & 1 deletion docs/data-sources/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ output "demo" {
- `memory` (Number) The total amount of memory available on the cluster's instance in GB (gigabytes).
- `name` (String) A human-readable name for the cluster.
- `plan_id` (String) The ID of the [cluster's plan](https://docs.crunchybridge.com/concepts/plans-pricing/). Determines instance, CPU, and memory.
- `postgres_version_id` (Number) The cluster's major Postgres version. For example, `14`.
- `postgres_version_id` (Number) The cluster's major Postgres version. For example, `16`.
- `provider_id` (String) The [cloud provider](https://docs.crunchybridge.com/api/provider) where the cluster is located.
- `region_id` (String) The [provider region](https://docs.crunchybridge.com/api/provider#region) where the cluster is located.
- `storage` (Number) The amount of storage available to the cluster in GB (gigabytes).
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ provider "crunchybridge" {

### Required

- `application_id` (String) The application id component of the Crunchy Bridge API key.
- `application_secret` (String) The application secret component of the Crunchy Bridge API key.

### Optional

- `application_id` (String) The application id component of the Crunchy Bridge API key. (deprecated)
- `bridgeapi_url` (String) The API URL for the Crunchy Bridge platform API. Most users should not need to change this value.
- `require_token_swap` (Boolean) When true, forces an exchange of the API key for a short-lived bearer token.

Expand Down
2 changes: 1 addition & 1 deletion docs/resources/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ output "demo_status" {
### Optional

- `is_ha` (Boolean) Whether the cluster is high availability, meaning that it has a secondary it can fail over to quickly in case the primary becomes unavailable. Defaults to `false`
- `major_version` (Number) The cluster's major Postgres version. For example, `14`. Defaults to [Create Cluster](https://docs.crunchybridge.com/api/cluster/#create-cluster) defaults.
- `major_version` (Number) The cluster's major Postgres version. For example, `16`. Defaults to [Create Cluster](https://docs.crunchybridge.com/api/cluster/#create-cluster) defaults.
- `plan_id` (String) The ID of the [cluster's plan](https://docs.crunchybridge.com/concepts/plans-pricing/). Determines instance, CPU, and memory. Defaults to `hobby-2`.
- `provider_id` (String) The [cloud provider](https://docs.crunchybridge.com/api/provider) where the cluster is located. Defaults to `aws`, allows `aws`, `gcp`, or `azure`
- `region_id` (String) The [provider region](https://docs.crunchybridge.com/api/provider#region) where the cluster is located. Defaults to `us-west-1`
Expand Down
2 changes: 1 addition & 1 deletion internal/bridgeapi/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
2 changes: 1 addition & 1 deletion internal/bridgeapi/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
2 changes: 1 addition & 1 deletion internal/bridgeapi/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func DefaultClusterName() string {
// 10 bits for adj
ixAdj := (entropy & 0x0000FFC0) >> 6
// 3 bits for digit 1
digit1 := 1 + (entropy & 0x00000038) >> 3
digit1 := 1 + (entropy&0x00000038)>>3
// 3 bits for digit 2
digit2 := 1 + (entropy & 0x00000007)

Expand Down
2 changes: 1 addition & 1 deletion internal/bridgeapi/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
2 changes: 1 addition & 1 deletion internal/bridgeapi/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
2 changes: 1 addition & 1 deletion internal/bridgeapi/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
14 changes: 7 additions & 7 deletions internal/bridgeapi/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand Down Expand Up @@ -39,7 +39,7 @@ type ClusterDetail struct {
HighAvailability bool `json:"is_ha"`
PGMajorVersion int `json:"major_version"`
MaintWindowStart int `json:"maintenance_window_start"`
MemoryGB int `json:"memory"`
MemoryGB float64 `json:"memory"` // 64 precision isn't required, but likely default arch
Name string `json:"name"`
PlanID string `json:"plan_id"`
ProviderID string `json:"provider_id"`
Expand Down Expand Up @@ -116,11 +116,11 @@ type ProviderDisk struct {
}

type Plan struct {
ID string `json:"id"`
CPU int `json:"cpu"`
Memory int `json:"memory"`
Name string `json:"display_name"`
Rate int `json:"rate"`
ID string `json:"id"`
CPU int `json:"cpu"`
Memory float64 `json:"memory"` // 64 precision isn't required, but likely default arch
Name string `json:"display_name"`
Rate int `json:"rate"`
}

type Region struct {
Expand Down
2 changes: 1 addition & 1 deletion internal/bridgeapi/quick_get.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
2 changes: 1 addition & 1 deletion internal/provider/data_source_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
4 changes: 2 additions & 2 deletions internal/provider/data_source_cloudprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand Down Expand Up @@ -57,7 +57,7 @@ func dataSourceCloudProvider() *schema.Resource {
"plan_memory": {
Computed: true,
Description: "The amount of memory on the plan’s instance in gigabytes.",
Type: schema.TypeInt,
Type: schema.TypeFloat,
},
"plan_name": {
Computed: true,
Expand Down
6 changes: 3 additions & 3 deletions internal/provider/data_source_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand Down Expand Up @@ -54,7 +54,7 @@ func dataSourceCluster() *schema.Resource {
},
"postgres_version_id": {
Computed: true,
Description: "The cluster's major Postgres version. For example, `14`.",
Description: "The cluster's major Postgres version. For example, `16`.",
Type: schema.TypeInt,
},
"maintenance_window_start": {
Expand All @@ -70,7 +70,7 @@ func dataSourceCluster() *schema.Resource {
"memory": {
Computed: true,
Description: "The total amount of memory available on the cluster's instance in GB (gigabytes).",
Type: schema.TypeInt,
Type: schema.TypeFloat,
},
"name": {
Computed: true,
Expand Down
2 changes: 1 addition & 1 deletion internal/provider/data_source_clusterids.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
2 changes: 1 addition & 1 deletion internal/provider/data_source_clusterrole.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
2 changes: 1 addition & 1 deletion internal/provider/data_source_clusterstatus.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
10 changes: 5 additions & 5 deletions internal/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand Down Expand Up @@ -65,9 +65,9 @@ func New(version string) func() *schema.Provider {
Schema: map[string]*schema.Schema{
idConfigName: {
Type: schema.TypeString,
Description: "The application id component of the Crunchy Bridge API key.",
Description: "The application id component of the Crunchy Bridge API key. (deprecated)",
DefaultFunc: schema.EnvDefaultFunc("APPLICATION_ID", nil),
Required: true,
Optional: true,
},
secretConfigName: {
Type: schema.TypeString,
Expand Down Expand Up @@ -105,8 +105,8 @@ func configure(version string, p *schema.Provider) func(context.Context, *schema

id := d.Get(idConfigName).(string)
secret := d.Get(secretConfigName).(string)
if (id == "") || (secret == "") {
return nil, diag.Errorf("%s and %s must be configured to non-empty strings for this provider", idConfigName, secretConfigName)
if secret == "" {
return nil, diag.Errorf("%s must be configured to a non-empty string for this provider", secretConfigName)
}
login := bridgeapi.Login{
Key: id,
Expand Down
1 change: 1 addition & 0 deletions internal/provider/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
// providerFactories are used to instantiate a provider during acceptance testing.
// The factory function will be invoked for every Terraform CLI command executed
// to create a provider server to which the CLI can reattach.
//
//lint:ignore U1000 used in other test files
var providerFactories = map[string]func() (*schema.Provider, error){
"scaffolding": func() (*schema.Provider, error) {
Expand Down
10 changes: 5 additions & 5 deletions internal/provider/resource_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand Down Expand Up @@ -96,11 +96,11 @@ func resourceCluster() *schema.Resource {
Type: schema.TypeBool,
},
"major_version": {
Default: 14,
Description: "The cluster's major Postgres version. For example, `14`. Defaults to [Create Cluster](https://docs.crunchybridge.com/api/cluster/#create-cluster) defaults.",
Default: 16,
Description: "The cluster's major Postgres version. For example, `16`. Defaults to [Create Cluster](https://docs.crunchybridge.com/api/cluster/#create-cluster) defaults.",
Optional: true,
Type: schema.TypeInt,
ValidateFunc: validation.IntAtLeast(12),
ValidateFunc: validation.IntAtLeast(14),
},
"wait_until_ready": {
Description: "Treats the create operation as incomplete until the cluster reports a ready status. Defaults to `false`",
Expand Down Expand Up @@ -136,7 +136,7 @@ func resourceCluster() *schema.Resource {
"memory": {
Computed: true,
Description: "The total amount of memory available on the cluster's instance in GB (gigabytes).",
Type: schema.TypeInt,
Type: schema.TypeFloat,
},
"updated_at": {
Computed: true,
Expand Down

0 comments on commit b5c1488

Please sign in to comment.