|
| 1 | +--- |
| 2 | +# WARNING: this file was fetched from https://raw.githubusercontent.com/formalco/pulumi-formal/v1.0.2/docs/_index.md |
| 3 | +# Do not edit by hand unless you're certain you know what you are doing! |
| 4 | +title: Formal Provider |
| 5 | +meta_desc: Provides an overview on how to configure the Pulumi Formal provider. |
| 6 | +layout: package |
| 7 | +--- |
| 8 | + |
| 9 | +## Installation |
| 10 | + |
| 11 | +The Formal provider is available as a package in the following Pulumi languages: |
| 12 | + |
| 13 | +* JavaScript/TypeScript: [`@formalco/pulumi`](https://www.npmjs.com/package/@formalco/pulumi) |
| 14 | +* Python: [`pulumi-formal`](https://pypi.org/project/pulumi-formal/) |
| 15 | +* Go: [`github.com/formalco/pulumi-formal/sdk/go/formal`](https://pkg.go.dev/github.com/formalco/pulumi-formal/sdk/go/formal) |
| 16 | +* .NET: [`Formal.Pulumi`](https://www.nuget.org/packages/Formal.Pulumi) |
| 17 | + |
| 18 | +## Overview |
| 19 | + |
| 20 | +Use the Formal Pulumi Provider to interact with the |
| 21 | +many resources supported by Formal. |
| 22 | + |
| 23 | +Use the navigation to the left to read about the available resources. |
| 24 | + |
| 25 | +## Authentication and Configuration |
| 26 | + |
| 27 | +Configuration for the Formal Provider is derived from the API tokens you can generate via the Formal Console. |
| 28 | + |
| 29 | +### Provider Configuration |
| 30 | + |
| 31 | +!> **Warning:** Hard-coded credentials are not recommended in any Pulumi |
| 32 | +configuration and risks secret leakage should this file ever be committed to a |
| 33 | +public version control system. |
| 34 | + |
| 35 | +Credentials can be provided by adding an `apiKey`: |
| 36 | + |
| 37 | +```yaml |
| 38 | +# Pulumi.yaml provider configuration file |
| 39 | +name: configuration-example |
| 40 | +runtime: |
| 41 | +config: |
| 42 | + formal:apiKey: |
| 43 | + value: '<apiKey>' |
| 44 | +``` |
| 45 | +
|
| 46 | +You can also use `pulumi config set formal:apiKey <apiKey> --secret` to set the API key. |
| 47 | + |
| 48 | +Credentials can also be provided by using the `FORMAL_API_KEY` environment variable. |
| 49 | + |
| 50 | +For example: |
| 51 | +```yaml |
| 52 | +# Pulumi.yaml provider configuration file |
| 53 | +name: configuration-example |
| 54 | +runtime: |
| 55 | +
|
| 56 | +``` |
| 57 | + |
| 58 | +```bash |
| 59 | +export FORMAL_API_KEY="some_api_key" pulumi up |
| 60 | +``` |
| 61 | + |
| 62 | +## Examples |
| 63 | + |
| 64 | +{{< chooser language "go,typescript,python,csharp" >}} |
| 65 | +{{% choosable language go %}} |
| 66 | +```go |
| 67 | +package main |
| 68 | +
|
| 69 | +import ( |
| 70 | + formal "github.com/formalco/pulumi-formal/sdk/go/formal" |
| 71 | + "github.com/pulumi/pulumi/sdk/v3/go/pulumi" |
| 72 | +) |
| 73 | +
|
| 74 | +func main() { |
| 75 | + pulumi.Run(func(ctx *pulumi.Context) error { |
| 76 | + // Create a new connector instance. |
| 77 | + _, err := formal.NewConnector(ctx, "demo-connector", &formal.ConnectorArgs{ |
| 78 | + Name: pulumi.String("demo-connector"), |
| 79 | + SpaceId: nil, |
| 80 | + TerminationProtection: pulumi.Bool(false), |
| 81 | + }) |
| 82 | +
|
| 83 | + return err |
| 84 | + }) |
| 85 | +} |
| 86 | +``` |
| 87 | +{{% /choosable %}} |
| 88 | + |
| 89 | +{{% choosable language typescript %}} |
| 90 | +```typescript |
| 91 | +import * as formal from "@formalco/pulumi"; |
| 92 | +
|
| 93 | +new formal.Connector('demo-connector', { |
| 94 | + name: 'demo-connector', |
| 95 | + spaceId: undefined, |
| 96 | + terminationProtection: false, |
| 97 | +}) |
| 98 | +``` |
| 99 | +{{% /choosable %}} |
| 100 | + |
| 101 | +{{% choosable language python %}} |
| 102 | +```python |
| 103 | +import pulumi_formal as formal |
| 104 | +
|
| 105 | +formal.Connector('demo-connector', |
| 106 | + name='demo-connector', |
| 107 | + space_id=None, |
| 108 | + termination_protection=False, |
| 109 | +) |
| 110 | +``` |
| 111 | +{{% /choosable %}} |
| 112 | + |
| 113 | +{{% choosable language csharp %}} |
| 114 | +```csharp |
| 115 | +using System.Collections.Generic; |
| 116 | +using Pulumi; |
| 117 | +using Formal.Pulumi; |
| 118 | +
|
| 119 | +return await Deployment.RunAsync(() => |
| 120 | +{ |
| 121 | + var connector = new Connector("demo-connector", new ConnectorArgs { |
| 122 | + Name = "demo-connector", |
| 123 | + SpaceId = null, |
| 124 | + TerminationProtection = false |
| 125 | + }); |
| 126 | +
|
| 127 | + // Export outputs here |
| 128 | + return new Dictionary<string, object?> |
| 129 | + { |
| 130 | + ["demo-connector"] = connector.Id |
| 131 | + }; |
| 132 | +}); |
| 133 | +``` |
| 134 | +{{% /choosable %}} |
| 135 | +{{< /chooser >}} |
| 136 | + |
| 137 | +More examples on how to deploy Formal resources are available in the [`examples/`](https://github.com/formalco/pulumi-formal/tree/main/examples) folder of the Formal Pulumi repository. |
0 commit comments