-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle empty config YAML and PCL conditions explicitly and show tests…
… for all possible combinations
- Loading branch information
1 parent
c1ee08d
commit 5fb65af
Showing
7 changed files
with
237 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
132 changes: 132 additions & 0 deletions
132
pkg/tfgen/test_data/installation-docs/example-only-expected.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
This example is invalid and should not be translated for this test to pass | ||
|
||
## Example Usage | ||
|
||
{{< chooser language "typescript,python,go,csharp,java,yaml" >}} | ||
{{% choosable language typescript %}} | ||
```typescript | ||
import * as pulumi from "@pulumi/pulumi"; | ||
import * as simple from "@pulumi/simple"; | ||
|
||
//# Define a resource | ||
const aResource = new simple.index.Resource("a_resource", { | ||
renamedInput1: "hello", | ||
inputTwo: true, | ||
}); | ||
export const someOutput = aResource.result; | ||
``` | ||
{{% /choosable %}} | ||
{{% choosable language python %}} | ||
```python | ||
import pulumi | ||
import pulumi_simple as simple | ||
|
||
## Define a resource | ||
a_resource = simple.index.Resource("a_resource", | ||
renamed_input1=hello, | ||
input_two=True) | ||
pulumi.export("someOutput", a_resource["result"]) | ||
``` | ||
{{% /choosable %}} | ||
{{% choosable language csharp %}} | ||
```csharp | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Pulumi; | ||
using Simple = Pulumi.Simple; | ||
|
||
return await Deployment.RunAsync(() => | ||
{ | ||
//# Define a resource | ||
var aResource = new Simple.Index.Resource("a_resource", new() | ||
{ | ||
RenamedInput1 = "hello", | ||
InputTwo = true, | ||
}); | ||
|
||
return new Dictionary<string, object?> | ||
{ | ||
["someOutput"] = aResource.Result, | ||
}; | ||
}); | ||
|
||
``` | ||
{{% /choosable %}} | ||
{{% choosable language go %}} | ||
```go | ||
package main | ||
|
||
import ( | ||
"github.com/pulumi/pulumi-simple/sdk/go/simple" | ||
"github.com/pulumi/pulumi/sdk/v3/go/pulumi" | ||
) | ||
|
||
func main() { | ||
pulumi.Run(func(ctx *pulumi.Context) error { | ||
// # Define a resource | ||
aResource, err := simple.NewResource(ctx, "a_resource", &simple.ResourceArgs{ | ||
RenamedInput1: "hello", | ||
InputTwo: true, | ||
}) | ||
if err != nil { | ||
return err | ||
} | ||
ctx.Export("someOutput", aResource.Result) | ||
return nil | ||
}) | ||
} | ||
``` | ||
{{% /choosable %}} | ||
{{% choosable language yaml %}} | ||
```yaml | ||
resources: | ||
## Define a resource | ||
aResource: | ||
type: simple:resource | ||
name: a_resource | ||
properties: | ||
renamedInput1: hello | ||
inputTwo: true | ||
outputs: | ||
someOutput: ${aResource.result} | ||
``` | ||
{{% /choosable %}} | ||
{{% choosable language java %}} | ||
```java | ||
package generated_program; | ||
|
||
import com.pulumi.Context; | ||
import com.pulumi.Pulumi; | ||
import com.pulumi.core.Output; | ||
import com.pulumi.simple.resource; | ||
import com.pulumi.simple.ResourceArgs; | ||
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) { | ||
//# Define a resource | ||
var aResource = new Resource("aResource", ResourceArgs.builder() | ||
.renamedInput1("hello") | ||
.inputTwo(true) | ||
.build()); | ||
|
||
ctx.export("someOutput", aResource.result()); | ||
} | ||
} | ||
``` | ||
{{% /choosable %}} | ||
{{< /chooser >}} | ||
|
||
|
||
## Configuration Reference | ||
|
||
The following configuration inputs are supported: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
This example is invalid and should not be translated for this test to pass | ||
|
||
## Example Usage | ||
|
||
```hcl | ||
## Define a resource | ||
resource "simple_resource" "a_resource" { | ||
input_one = "hello" | ||
input_two = true | ||
} | ||
output "some_output" { | ||
value = simple_resource.a_resource.result | ||
} | ||
``` | ||
|
||
## Configuration Reference | ||
|
||
The following configuration inputs are supported: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
pkg/tfgen/test_data/installation-docs/provider-config-only-expected.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
This example should translate at least the Pulumi config | ||
|
||
## Example Usage | ||
|
||
```yaml | ||
# Pulumi.yaml provider configuration file | ||
name: configuration-example | ||
runtime: | ||
config: | ||
simple-provider:authUrl: | ||
value: http://myauthurl:5000/v3 | ||
simple-provider:password: | ||
value: pwd | ||
simple-provider:region: | ||
value: RegionOne | ||
simple-provider:tenantName: | ||
value: admin | ||
simple-provider:userName: | ||
value: admin | ||
|
||
``` | ||
|
||
|
||
## Configuration Reference | ||
|
||
The following configuration inputs are supported: |
18 changes: 18 additions & 0 deletions
18
pkg/tfgen/test_data/installation-docs/provider-config-only.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
This example should translate at least the Pulumi config | ||
|
||
## Example Usage | ||
|
||
```hcl | ||
# Configure the OpenStack Provider | ||
provider "simple-provider" { | ||
user_name = "admin" | ||
tenant_name = "admin" | ||
password = "pwd" | ||
auth_url = "http://myauthurl:5000/v3" | ||
region = "RegionOne" | ||
} | ||
``` | ||
|
||
## Configuration Reference | ||
|
||
The following configuration inputs are supported: |