Skip to content

Commit

Permalink
Add installation docs with automation (#846)
Browse files Browse the repository at this point in the history
Part of pulumi/home#3598

Generates a single index.md file with relevant content and adds
automation.
  • Loading branch information
guineveresaenger authored Oct 7, 2024
1 parent 2e0190e commit 24ec9ff
Show file tree
Hide file tree
Showing 3 changed files with 293 additions and 1 deletion.
1 change: 1 addition & 0 deletions .ci-mgmt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ plugins:
version: "4.0.0"
team: ecosystem
pulumiConvert: 1
registryDocs: true
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ development: install_plugins provider build_sdks install_sdks

build: install_plugins provider build_sdks install_sdks

build_sdks: build_nodejs build_python build_dotnet build_go build_java
build_sdks: build_nodejs build_python build_dotnet build_go build_java build_registry_docs

install_go_sdk:

Expand Down Expand Up @@ -96,6 +96,10 @@ build_python: upstream
cd ./bin && \
../venv/bin/python -m build .

# Run the bridge's registry-docs command to generated the content of the installation docs/ folder at provider repo root
build_registry_docs:
$(WORKING_DIR)/bin/$(TFGEN) registry-docs --out $(WORKING_DIR)/docs

clean:
rm -rf sdk/{dotnet,nodejs,go,python}

Expand Down
287 changes: 287 additions & 0 deletions docs/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,287 @@
---
title: Spotinst Provider
meta_desc: Provides an overview on how to configure the Pulumi Spotinst provider.
layout: package
---
## Installation

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

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

The Spotinst provider is used to interact with the
resources supported by Spotinst. The provider needs to be configured
with the proper credentials before it can be used.

Use the navigation to the left to read about the available resources.
## 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:
spotinst:account:
value: 'TODO: "${var.spotinst_account}"'
spotinst:token:
value: 'TODO: "${var.spotinst_token}"'

```
```typescript
import * as pulumi from "@pulumi/pulumi";
import * as spotinst from "@pulumi/spotinst";

// Create an Elastigroup
const foo = new spotinst.aws.Elastigroup("foo", {});
```
{{% /choosable %}}
{{% choosable language python %}}
```yaml
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: python
config:
spotinst:account:
value: 'TODO: "${var.spotinst_account}"'
spotinst:token:
value: 'TODO: "${var.spotinst_token}"'

```
```python
import pulumi
import pulumi_spotinst as spotinst

# Create an Elastigroup
foo = spotinst.aws.Elastigroup("foo")
```
{{% /choosable %}}
{{% choosable language csharp %}}
```yaml
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: dotnet
config:
spotinst:account:
value: 'TODO: "${var.spotinst_account}"'
spotinst:token:
value: 'TODO: "${var.spotinst_token}"'

```
```csharp
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using SpotInst = Pulumi.SpotInst;

return await Deployment.RunAsync(() =>
{
// Create an Elastigroup
var foo = new SpotInst.Aws.Elastigroup("foo");

});

```
{{% /choosable %}}
{{% choosable language go %}}
```yaml
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: go
config:
spotinst:account:
value: 'TODO: "${var.spotinst_account}"'
spotinst:token:
value: 'TODO: "${var.spotinst_token}"'

```
```go
package main

import (
"github.com/pulumi/pulumi-spotinst/sdk/v3/go/spotinst/aws"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
// Create an Elastigroup
_, err := aws.NewElastigroup(ctx, "foo", nil)
if err != nil {
return err
}
return nil
})
}
```
{{% /choosable %}}
{{% choosable language yaml %}}
```yaml
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: yaml
config:
spotinst:account:
value: 'TODO: "${var.spotinst_account}"'
spotinst:token:
value: 'TODO: "${var.spotinst_token}"'

```
```yaml
resources:
# Create an Elastigroup
foo:
type: spotinst:aws:Elastigroup
```
{{% /choosable %}}
{{% choosable language java %}}
```yaml
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: java
config:
spotinst:account:
value: 'TODO: "${var.spotinst_account}"'
spotinst:token:
value: 'TODO: "${var.spotinst_token}"'

```
```java
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.spotinst.aws.Elastigroup;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}

public static void stack(Context ctx) {
// Create an Elastigroup
var foo = new Elastigroup("foo");

}
}
```
{{% /choosable %}}
{{< /chooser >}}
## Configuration Reference

The following configuration inputs are supported:

* `enabled` - (Optional) Boolean value to enable or disable the provider. Default is `true`.
* `token` - (Required) A Personal API Access Token issued by Spotinst. It can be sourced from the `SPOTINST_TOKEN` environment variable.
* `account` - (Optional) A valid Spotinst account ID. It can be sourced from the `SPOTINST_ACCOUNT` environment variable.
* `featureFlags` - (Optional) Spotinst SDK feature flags. They can be sourced from the `SPOTINST_FEATURE_FLAGS` environment variable.
## Credential Precedence

Credentials will be set given the following precedence:
1. credentials defined in the provider configuration of the template
2. credentials defined as environment variables
3. credentials defined in ~/.spotinst/credentials

The credentials can be merge in the chain by enabling the `MergeCredentialsChain` feature flag.

{{< chooser language "typescript,python,go,csharp,java,yaml" >}}
{{% choosable language typescript %}}
```yaml
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: nodejs
config:
spotinst:account:
value: 'TODO: "${var.spotinst_account}"'
spotinst:featureFlags:
value: MergeCredentialsChain=true

```

{{% /choosable %}}
{{% choosable language python %}}
```yaml
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: python
config:
spotinst:account:
value: 'TODO: "${var.spotinst_account}"'
spotinst:featureFlags:
value: MergeCredentialsChain=true

```

{{% /choosable %}}
{{% choosable language csharp %}}
```yaml
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: dotnet
config:
spotinst:account:
value: 'TODO: "${var.spotinst_account}"'
spotinst:featureFlags:
value: MergeCredentialsChain=true

```

{{% /choosable %}}
{{% choosable language go %}}
```yaml
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: go
config:
spotinst:account:
value: 'TODO: "${var.spotinst_account}"'
spotinst:featureFlags:
value: MergeCredentialsChain=true

```

{{% /choosable %}}
{{% choosable language yaml %}}
```yaml
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: yaml
config:
spotinst:account:
value: 'TODO: "${var.spotinst_account}"'
spotinst:featureFlags:
value: MergeCredentialsChain=true

```

{{% /choosable %}}
{{% choosable language java %}}
```yaml
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: java
config:
spotinst:account:
value: 'TODO: "${var.spotinst_account}"'
spotinst:featureFlags:
value: MergeCredentialsChain=true

```

{{% /choosable %}}
{{< /chooser >}}

Please note that if you omit the Spotinst account, resources will be created using the default account for your organization.

0 comments on commit 24ec9ff

Please sign in to comment.