Skip to content

Commit

Permalink
docs: update dragonfly and add example (#1671)
Browse files Browse the repository at this point in the history
  • Loading branch information
staceysalamon-aiven authored Mar 22, 2024
1 parent 38088af commit cf1b359
Show file tree
Hide file tree
Showing 10 changed files with 80 additions and 6 deletions.
11 changes: 9 additions & 2 deletions docs/data-sources/dragonfly.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,21 @@
page_title: "aiven_dragonfly Data Source - terraform-provider-aiven"
subcategory: ""
description: |-
The Dragonfly data source provides information about the existing Aiven Dragonfly service.
Gets information about an Aiven for Dragonfly® service.
---

# aiven_dragonfly (Data Source)

The Dragonfly data source provides information about the existing Aiven Dragonfly service.
Gets information about an Aiven for Dragonfly® service.

## Example Usage

```terraform
data "aiven_dragonfly" "example_dragonfly" {
project = data.aiven_project.example_project.project
service_name = "example-dragonfly-service"
}
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down
25 changes: 23 additions & 2 deletions docs/resources/dragonfly.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,27 @@
page_title: "aiven_dragonfly Resource - terraform-provider-aiven"
subcategory: ""
description: |-
The Dragonfly resource allows the creation and management of Aiven Dragonfly services.
Creates and manages an Aiven for Dragonfly® https://aiven.io/docs/products/dragonfly/concepts/overview service.
---

# aiven_dragonfly (Resource)

The Dragonfly resource allows the creation and management of Aiven Dragonfly services.
Creates and manages an [Aiven for Dragonfly®](https://aiven.io/docs/products/dragonfly/concepts/overview) service.

## Example Usage

```terraform
resource "aiven_dragonfly" "example_dragonfly" {
project = data.aiven_project.example_project.project
plan = "startup-4"
cloud_name = "google-europe-west1"
service_name = "example-dragonfly-service"
dragonfly_user_config {
cache_mode = true
}
}
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down Expand Up @@ -189,3 +202,11 @@ Read-Only:
### Nested Schema for `dragonfly`

Read-Only:

## Import

Import is supported using the following syntax:

```shell
terraform import aiven_dragonfly.example_dragonfly PROJECT/SERVICE_NAME
```
4 changes: 4 additions & 0 deletions examples/data-sources/aiven_dragonfly/data-source.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
data "aiven_dragonfly" "example_dragonfly" {
project = data.aiven_project.example_project.project
service_name = "example-dragonfly-service"
}
12 changes: 12 additions & 0 deletions examples/dragonfly/provider.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
terraform {
required_providers {
aiven = {
source = "aiven/aiven"
version = ">=4.0.0, <5.0.0"
}
}
}

provider "aiven" {
api_token = var.aiven_token
}
10 changes: 10 additions & 0 deletions examples/dragonfly/service.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
resource "aiven_dragonfly" "example_dragonfly" {
project = var.aiven_project_name
plan = "startup-4"
cloud_name = "google-europe-west1"
service_name = "example-dragonfly-service"

dragonfly_user_config {
cache_mode = true
}
}
9 changes: 9 additions & 0 deletions examples/dragonfly/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
variable "aiven_token" {
description = "Aiven token"
type = string
}

variable "aiven_project_name" {
description = "Aiven project name"
type = string
}
1 change: 1 addition & 0 deletions examples/resources/aiven_dragonfly/import.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
terraform import aiven_dragonfly.example_dragonfly PROJECT/SERVICE_NAME
10 changes: 10 additions & 0 deletions examples/resources/aiven_dragonfly/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
resource "aiven_dragonfly" "example_dragonfly" {
project = data.aiven_project.example_project.project
plan = "startup-4"
cloud_name = "google-europe-west1"
service_name = "example-dragonfly-service"

dragonfly_user_config {
cache_mode = true
}
}
2 changes: 1 addition & 1 deletion internal/sdkprovider/service/dragonfly/dragonfly.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func dragonflySchema() map[string]*schema.Schema {

func ResourceDragonfly() *schema.Resource {
return &schema.Resource{
Description: "The Dragonfly resource allows the creation and management of Aiven Dragonfly services.",
Description: "Creates and manages an [Aiven for Dragonfly®](https://aiven.io/docs/products/dragonfly/concepts/overview) service.",
CreateContext: schemautil.ResourceServiceCreateWrapper(schemautil.ServiceTypeDragonfly),
ReadContext: schemautil.ResourceServiceRead,
UpdateContext: schemautil.ResourceServiceUpdate,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
func DatasourceDragonfly() *schema.Resource {
return &schema.Resource{
ReadContext: schemautil.DatasourceServiceRead,
Description: "The Dragonfly data source provides information about the existing Aiven Dragonfly service.",
Description: "Gets information about an Aiven for Dragonfly® service.",
Schema: schemautil.ResourceSchemaAsDatasourceSchema(dragonflySchema(), "project", "service_name"),
}
}

0 comments on commit cf1b359

Please sign in to comment.