Add examples, generate docs and fix acc tests (#386)
This commit is contained in:
parent
335e1cabb6
commit
04df2f2f89
6 changed files with 57 additions and 7 deletions
|
|
@ -10,7 +10,14 @@ description: |-
|
|||
|
||||
MongoDB Flex instance data source schema. Must have a `region` specified in the provider configuration.
|
||||
|
||||
## Example Usage
|
||||
|
||||
```terraform
|
||||
data "stackit_sqlserverflex_instance" "example" {
|
||||
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
||||
instance_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
||||
}
|
||||
```
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
|
|
|||
|
|
@ -3,14 +3,33 @@
|
|||
page_title: "stackit_sqlserverflex_instance Resource - stackit"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
SQL Server Flex instance resource schema. Must have a region specified in the provider configuration.
|
||||
SQLServer Flex instance resource schema. Must have a region specified in the provider configuration.
|
||||
---
|
||||
|
||||
# stackit_sqlserverflex_instance (Resource)
|
||||
|
||||
SQL Server Flex instance resource schema. Must have a `region` specified in the provider configuration.
|
||||
SQLServer Flex instance resource schema. Must have a `region` specified in the provider configuration.
|
||||
|
||||
## Example Usage
|
||||
|
||||
```terraform
|
||||
resource "stackit_sqlserverflex_instance" "example" {
|
||||
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
||||
name = "example-instance"
|
||||
acl = ["XXX.XXX.XXX.X/XX", "XX.XXX.XX.X/XX"]
|
||||
backup_schedule = "00 00 * * *"
|
||||
flavor = {
|
||||
cpu = 4
|
||||
ram = 16
|
||||
}
|
||||
replicas = 3
|
||||
storage = {
|
||||
class = "class"
|
||||
size = 5
|
||||
}
|
||||
version = 2022
|
||||
}
|
||||
```
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
|
@ -23,7 +42,7 @@ SQL Server Flex instance resource schema. Must have a `region` specified in the
|
|||
|
||||
### Optional
|
||||
|
||||
- `acl` (List of String) The Access Control List (ACL) for the SQL Server Flex instance.
|
||||
- `acl` (List of String) The Access Control List (ACL) for the SQLServer Flex instance.
|
||||
- `backup_schedule` (String) The backup schedule. Should follow the cron scheduling system format (e.g. "0 0 * * *")
|
||||
- `options` (Attributes) (see [below for nested schema](#nestedatt--options))
|
||||
- `storage` (Attributes) (see [below for nested schema](#nestedatt--storage))
|
||||
|
|
@ -32,7 +51,7 @@ SQL Server Flex instance resource schema. Must have a `region` specified in the
|
|||
### Read-Only
|
||||
|
||||
- `id` (String) Terraform's internal resource ID. It is structured as "`project_id`,`instance_id`".
|
||||
- `instance_id` (String) ID of the SQL Server Flex instance.
|
||||
- `instance_id` (String) ID of the SQLServer Flex instance.
|
||||
- `replicas` (Number)
|
||||
|
||||
<a id="nestedatt--flavor"></a>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,4 @@
|
|||
data "stackit_sqlserverflex_instance" "example" {
|
||||
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
||||
instance_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
resource "stackit_sqlserverflex_instance" "example" {
|
||||
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
||||
name = "example-instance"
|
||||
acl = ["XXX.XXX.XXX.X/XX", "XX.XXX.XX.X/XX"]
|
||||
backup_schedule = "00 00 * * *"
|
||||
flavor = {
|
||||
cpu = 4
|
||||
ram = 16
|
||||
}
|
||||
replicas = 3
|
||||
storage = {
|
||||
class = "class"
|
||||
size = 5
|
||||
}
|
||||
version = 2022
|
||||
}
|
||||
|
|
@ -695,7 +695,9 @@ func mapFields(ctx context.Context, resp *sqlserverflex.GetInstanceResponse, mod
|
|||
edition := options.Edition
|
||||
editionValue, ok := (*instance.Options)["edition"]
|
||||
if ok {
|
||||
edition = types.StringValue(editionValue)
|
||||
// API returns edition in uppercase but validates if it is lowercase
|
||||
// This is a workaround that should be removed when the API is fixed
|
||||
edition = types.StringValue(strings.ToLower(editionValue))
|
||||
}
|
||||
|
||||
optionsValues = map[string]attr.Value{
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ var instanceResource = map[string]string{
|
|||
"storage_size": "40",
|
||||
"version": "2022",
|
||||
"replicas": "1",
|
||||
"options_edition": "developer",
|
||||
"options_edition": "standard",
|
||||
"options_retention_days": "64",
|
||||
"flavor_id": "4.16-Single",
|
||||
"backup_schedule": "00 6 * * *",
|
||||
|
|
@ -201,7 +201,9 @@ func testAccChecksqlserverflexDestroy(s *terraform.State) error {
|
|||
var client *sqlserverflex.APIClient
|
||||
var err error
|
||||
if testutil.SQLServerFlexCustomEndpoint == "" {
|
||||
client, err = sqlserverflex.NewAPIClient()
|
||||
client, err = sqlserverflex.NewAPIClient(
|
||||
config.WithRegion("eu01"),
|
||||
)
|
||||
} else {
|
||||
client, err = sqlserverflex.NewAPIClient(
|
||||
config.WithEndpoint(testutil.SQLServerFlexCustomEndpoint),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue