Skip to content

Commit

Permalink
Add installation instructions for Aiven (#702)
Browse files Browse the repository at this point in the history
Some sections were redacted via docsEditRules.

Part of pulumi/home#3598.
  • Loading branch information
guineveresaenger authored Aug 22, 2024
2 parents d33e473 + 8a82d2e commit 96fc863
Show file tree
Hide file tree
Showing 3 changed files with 151 additions and 0 deletions.
5 changes: 5 additions & 0 deletions docs/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Aiven
meta_desc: The Aiven provider for Pulumi can be used to provision any of the cloud resources available in Aiven.
layout: package
---
103 changes: 103 additions & 0 deletions docs/installation-configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
---
title: Aiven Provider for Pulumi Installation & Configuration
meta_desc: Provides an overview on how to configure the Pulumi Aiven Provider for Pulumi.
layout: package
---
## Installation

The aiven provider is available as a package in all Pulumi languages:

* JavaScript/TypeScript: [`@pulumi/aiven`](https://www.npmjs.com/package/@pulumi/aiven)
* Python: [`pulumi-aiven`](https://pypi.org/project/pulumi-aiven/)
* Go: [`github.com/pulumi/pulumi-aiven/sdk/v6/go/aiven`](https://github.com/pulumi/pulumi-aiven)
* .NET: [`Pulumi.Aiven`](https://www.nuget.org/packages/Pulumi.Aiven)
* Java: [`com.pulumi/aiven`](https://central.sonatype.com/artifact/com.pulumi/aiven)

The Pulumi provider for [Aiven](https://aiven.io/), the trusted open source data platform for everyone.
## Authentication
Sign up for Aiven and [create a personal token](https://aiven.io/docs/platform/howto/create_authentication_token).

You can also create an [application user](https://aiven.io/docs/platform/howto/manage-application-users) and use its token for accessing the Aiven Provider.
## Example usage

{{< chooser language "typescript,python,go,csharp,java,yaml" >}}
{{% choosable language typescript %}}
```yaml
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: nodejs
config:
aiven:apiToken:
value: 'TODO: var.aiven_api_token'

```

{{% /choosable %}}
{{% choosable language python %}}
```yaml
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: python
config:
aiven:apiToken:
value: 'TODO: var.aiven_api_token'

```

{{% /choosable %}}
{{% choosable language csharp %}}
```yaml
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: dotnet
config:
aiven:apiToken:
value: 'TODO: var.aiven_api_token'

```

{{% /choosable %}}
{{% choosable language go %}}
```yaml
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: go
config:
aiven:apiToken:
value: 'TODO: var.aiven_api_token'

```

{{% /choosable %}}
{{% choosable language yaml %}}
```yaml
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: yaml
config:
aiven:apiToken:
value: 'TODO: var.aiven_api_token'

```

{{% /choosable %}}
{{% choosable language java %}}
```yaml
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: java
config:
aiven:apiToken:
value: 'TODO: var.aiven_api_token'

```

{{% /choosable %}}
{{< /chooser >}}
## Environment variables

* For authentication, you can set the `AIVEN_TOKEN` to your token value.
* To use beta resources, set `PROVIDER_AIVEN_ENABLE_BETA` to any value.
* To allow IP filters to be purged, set `AIVEN_ALLOW_IP_FILTER_PURGE` to any value. This feature prevents accidental purging of IP filters, which can cause you to lose access to services.
## Resource options
The list of options in this document is not comprehensive. However, most map directly to the [Aiven REST API](https://api.aiven.io/doc/) properties.
43 changes: 43 additions & 0 deletions provider/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ package aiven
import (
"context"
"fmt"
"github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen"
"os"
"path/filepath"
"regexp"
"unicode"

// embed is used to store bridge-metadata.json in the compiled binary
Expand Down Expand Up @@ -98,6 +100,7 @@ func Provider(ctx context.Context) tfbridge.ProviderInfo {
UpstreamRepoPath: "./upstream",
Version: version.Version,
MetadataInfo: tfbridge.NewProviderMetadata(metadata),
DocRules: &tfbridge.DocRuleInfo{EditRules: docEditRules},
Config: map[string]*tfbridge.SchemaInfo{
"api_token": {Secret: tfbridge.True()},
},
Expand Down Expand Up @@ -229,5 +232,45 @@ func Provider(ctx context.Context) tfbridge.ProviderInfo {
return prov
}

func docEditRules(defaults []tfbridge.DocsEdit) []tfbridge.DocsEdit {
return append(
defaults,
removeTFAndLater,
skipWarningSection,
skipExamplesSection,
)
}

// Removes a "Warnings" section that includes TF-specific recommendations
var skipWarningSection = tfbridge.DocsEdit{
Path: "index.md",
Edit: func(_ string, content []byte) ([]byte, error) {
return tfgen.SkipSectionByHeaderContent(content, func(headerText string) bool {
return headerText == "Warning"
})
},
}

// Removes a section containing TF-specific tutorial links.
// This is *not* the "Example Usage" section, and doesn't actually contain any code examples.
var skipExamplesSection = tfbridge.DocsEdit{
Path: "index.md",
Edit: func(_ string, content []byte) ([]byte, error) {
return tfgen.SkipSectionByHeaderContent(content, func(headerText string) bool {
return headerText == "Examples"
})
},
}

// Removes a reference to TF version and compatibility
var TFVersionOrLaterRegexp = regexp.MustCompile(`(?s)For [tT]erraform v[0-9]+\.?[0-9]?\.?[0-9]? and later:`)
var removeTFAndLater = tfbridge.DocsEdit{
Path: "index.md",
Edit: func(_ string, content []byte) ([]byte, error) {
content = TFVersionOrLaterRegexp.ReplaceAllLiteral(content, nil)
return content, nil
},
}

//go:embed cmd/pulumi-resource-aiven/bridge-metadata.json
var metadata []byte

0 comments on commit 96fc863

Please sign in to comment.