Skip to content

Commit

Permalink
fixup! generate examples from terraform examples upstream
Browse files Browse the repository at this point in the history
Signed-off-by: Oscar Cobles <[email protected]>
  • Loading branch information
Oscar Cobles committed Jul 12, 2024
1 parent 02b075c commit a043f39
Show file tree
Hide file tree
Showing 77 changed files with 1,994 additions and 1,110 deletions.
9 changes: 2 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@ development: install_plugins provider lint_provider build_sdks install_sdks clea
build: install_plugins provider build_sdks install_sdks
only_build: build

tfgen: cleanup install_plugins upstream
tfgen: cleanup install_plugins upstream examples
(cd provider && go build -o $(WORKING_DIR)/bin/${TFGEN} -ldflags "-X ${PROJECT}/${VERSION_PATH}=${VERSION}" ${PROJECT}/${PROVIDER_PATH}/cmd/${TFGEN})
$(WORKING_DIR)/bin/${TFGEN} schema --out provider/cmd/${PROVIDER}
(cd provider && VERSION=$(VERSION) go generate cmd/${PROVIDER}/main.go)


bin/pulumi-java-gen: .pulumi-java-gen.version
pulumictl download-binary -n pulumi-language-java -v v$(shell cat .pulumi-java-gen.version) -r pulumi/pulumi-java

Expand Down Expand Up @@ -197,12 +198,6 @@ upstream.rebase:
examples: install_equinix_plugin
scripts/generate_examples.sh

examples_check: examples
if git status --porcelain | grep examples; then \
echo "Uncommitted changes detected. Run 'make examples' and commit changes."; \
exit 1; \
fi

# Compute the version of Pulumi to use by inspecting the Go dependencies of the provider.
.pulumi/version:
@mkdir -p .pulumi
Expand Down
4 changes: 2 additions & 2 deletions docs/resource/equinix_metal_connection.examples.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## Example Usage

{{% example %}}
### metal billed token
### example metal billed token
```typescript
import * as pulumi from "@pulumi/pulumi";
import * as equinix from "@equinix-labs/pulumi-equinix";
Expand Down Expand Up @@ -184,7 +184,7 @@ outputs:
{{% /example %}}
{{% example %}}
### fabric billed token
### example fabric billed token
```typescript
import * as pulumi from "@pulumi/pulumi";
import * as equinix from "@equinix-labs/pulumi-equinix";
Expand Down
131 changes: 131 additions & 0 deletions docs/resource/equinix_metal_device_network_type.examples.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
## Example Usage
{{% example %}}
```typescript
import * as pulumi from "@pulumi/pulumi";
import * as equinix from "@equinix-labs/pulumi-equinix";

const config = new pulumi.Config();
const deviceId = config.require("deviceId");
const networkType = config.get("networkType") || "hybrid";
const deviceNetwork = new equinix.metal.DeviceNetworkType("deviceNetwork", {
deviceId: deviceId,
type: networkType,
});
export const deviceNetworkId = deviceNetwork.id;
```
```python
import pulumi
import pulumi_equinix as equinix

config = pulumi.Config()
device_id = config.require("deviceId")
network_type = config.get("networkType")
if network_type is None:
network_type = "hybrid"
device_network = equinix.metal.DeviceNetworkType("deviceNetwork",
device_id=device_id,
type=network_type)
pulumi.export("deviceNetworkId", device_network.id)
```
```go
package main

import (
"github.com/equinix/pulumi-equinix/sdk/go/equinix/metal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)

func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
cfg := config.New(ctx, "")
deviceId := cfg.Require("deviceId")
networkType := "hybrid"
if param := cfg.Get("networkType"); param != "" {
networkType = param
}
deviceNetwork, err := metal.NewDeviceNetworkType(ctx, "deviceNetwork", &metal.DeviceNetworkTypeArgs{
DeviceId: pulumi.String(deviceId),
Type: pulumi.String(networkType),
})
if err != nil {
return err
}
ctx.Export("deviceNetworkId", deviceNetwork.ID())
return nil
})
}
```
```csharp
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Equinix = Pulumi.Equinix;

return await Deployment.RunAsync(() =>
{
var config = new Config();
var deviceId = config.Require("deviceId");
var networkType = config.Get("networkType") ?? "hybrid";
var deviceNetwork = new Equinix.Metal.DeviceNetworkType("deviceNetwork", new()
{
DeviceId = deviceId,
Type = networkType,
});

return new Dictionary<string, object?>
{
["deviceNetworkId"] = deviceNetwork.Id,
};
});
```
```java
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.equinix.metal.DeviceNetworkType;
import com.pulumi.equinix.metal.DeviceNetworkTypeArgs;
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) {
final var config = ctx.config();
final var deviceId = config.get("deviceId");
final var networkType = config.get("networkType").orElse("hybrid");
var deviceNetwork = new DeviceNetworkType("deviceNetwork", DeviceNetworkTypeArgs.builder()
.deviceId(deviceId)
.type(networkType)
.build());

ctx.export("deviceNetworkId", deviceNetwork.id());
}
}
```
```yaml
config:
deviceId:
type: string
networkType:
type: string
default: hybrid
resources:
deviceNetwork:
type: equinix:metal:DeviceNetworkType
properties:
deviceId: ${deviceId}
type: ${networkType}
outputs:
deviceNetworkId: ${deviceNetwork.id}
```
{{% /example %}}
Loading

0 comments on commit a043f39

Please sign in to comment.