Skip to content

Commit

Permalink
update postgres flex attrs. in resource + data (#43)
Browse files Browse the repository at this point in the history
* update postgres flex attrs. in resource + data

Co-authored-by: Dean Oren <deangili.oren@mail.schwarz>
  • Loading branch information
do87 and Dean Oren authored Nov 14, 2022
1 parent b50bd1b commit f5f8fdf
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 39 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ terraform {
required_providers {
stackit = {
source = "SchwarzIT/stackit"
version = "=1.2.1"
version = "=1.2.2"
}
}
}
Expand Down
7 changes: 1 addition & 6 deletions docs/data-sources/postgres_flex_instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,9 @@ data "stackit_postgres_flex_instance" "example" {
- `name` (String) Specifies the instance name
- `project_id` (String) The project ID

### Optional

- `acl` (List of String) Access Control rules to whitelist IP addresses
- `labels` (Map of String) Instance Labels
- `options` (Map of String) Specifies postgres instance options

### Read-Only

- `acl` (List of String) Access Control rules to whitelist IP addresses
- `backup_schedule` (String) Specifies the backup schedule (cron style)
- `id` (String) Specifies the resource ID
- `machine_type` (String) The Machine Type
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ terraform {
required_providers {
stackit = {
source = "SchwarzIT/stackit"
version = "=1.2.1"
version = "=1.2.2"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions docs/resources/postgres_flex_instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ resource "stackit_postgres_flex_instance" "example" {
- `machine_type` (String) The Machine Type. Available options: `c1.2` `m1.2`, `c1.3`, `m1.3`, `c1.4`, `c1.5`, `m1.5`
- `name` (String) Specifies the instance name. Changing this value requires the resource to be recreated.
- `project_id` (String) The project ID the instance runs in. Changing this value requires the resource to be recreated.
- `version` (String) Postgres version. Options: `13`, `14`. Changing this value requires the resource to be recreated.

### Optional

- `acl` (List of String) Access Control rules to whitelist IP addresses
- `backup_schedule` (String) Specifies the backup schedule (cron style)
- `labels` (Map of String) Instance Labels
- `options` (Map of String) Specifies postgres instance options
- `replicas` (Number) How many replicas of the database should exist. Changing this value requires the resource to be recreated.
- `replicas` (Number) Number of replicas (Default is `1`). Changing this value requires the resource to be recreated.
- `storage` (Attributes) A signle `storage` block as defined below. Changing this value requires the resource to be recreated. (see [below for nested schema](#nestedatt--storage))
- `version` (String) Postgres version. Options: `13`, `14`. Changing this value requires the resource to be recreated.

### Read-Only

Expand Down
2 changes: 1 addition & 1 deletion examples/provider/provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ terraform {
required_providers {
stackit = {
source = "SchwarzIT/stackit"
version = "=1.2.1"
version = "=1.2.2"
}
}
}
Expand Down
35 changes: 9 additions & 26 deletions stackit/internal/data-sources/postgres-flex/instance/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,15 @@ import (

// Instance is the schema model
type Instance struct {
ID types.String `tfsdk:"id"`
Name types.String `tfsdk:"name"`
ProjectID types.String `tfsdk:"project_id"`
MachineType types.String `tfsdk:"machine_type"`
Version types.String `tfsdk:"version"`
Replicas types.Int64 `tfsdk:"replicas"`
BackupSchedule types.String `tfsdk:"backup_schedule"`
Options map[string]string `tfsdk:"options"`
Labels map[string]string `tfsdk:"labels"`
ACL types.List `tfsdk:"acl"`
Storage types.Object `tfsdk:"storage"`
ID types.String `tfsdk:"id"`
Name types.String `tfsdk:"name"`
ProjectID types.String `tfsdk:"project_id"`
MachineType types.String `tfsdk:"machine_type"`
Version types.String `tfsdk:"version"`
Replicas types.Int64 `tfsdk:"replicas"`
BackupSchedule types.String `tfsdk:"backup_schedule"`
ACL types.List `tfsdk:"acl"`
Storage types.Object `tfsdk:"storage"`
}

// GetSchema returns the terraform schema structure
Expand Down Expand Up @@ -98,24 +96,9 @@ func (r DataSource) GetSchema(_ context.Context) (tfsdk.Schema, diag.Diagnostics
},
}),
},
"options": {
Description: "Specifies postgres instance options",
Type: types.MapType{
ElemType: types.StringType,
},
Optional: true,
},
"labels": {
Description: "Instance Labels",
Type: types.MapType{
ElemType: types.StringType,
},
Optional: true,
},
"acl": {
Description: "Access Control rules to whitelist IP addresses",
Type: types.ListType{ElemType: types.StringType},
Optional: true,
Computed: true,
},
},
Expand Down
4 changes: 2 additions & 2 deletions stackit/internal/resources/postgres-flex/instance/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,13 @@ func (r *Resource) GetSchema(_ context.Context) (tfsdk.Schema, diag.Diagnostics)
"version": {
Description: "Postgres version. Options: `13`, `14`. Changing this value requires the resource to be recreated.",
Type: types.StringType,
Optional: true,
Required: true,
PlanModifiers: []tfsdk.AttributePlanModifier{
resource.RequiresReplace(),
},
},
"replicas": {
Description: "How many replicas of the database should exist. Changing this value requires the resource to be recreated.",
Description: "Number of replicas (Default is `1`). Changing this value requires the resource to be recreated.",
Type: types.Int64Type,
Optional: true,
PlanModifiers: []tfsdk.AttributePlanModifier{
Expand Down

0 comments on commit f5f8fdf

Please sign in to comment.