Adding Equinix Metal examples equivalent to Packet.net to help with provider deprecation
MODIFY
.github/workflows/cron.yml
.github/workflows/cron.yml
@@ -230,6 +230,7 @@ jobs:
- Aws
- Azure
- Gcp
+ - EquinixMetal
- Packet
- Cloud
dotnet-version:

MODIFY
.github/workflows/run-tests-command.yml
.github/workflows/run-tests-command.yml
@@ -244,6 +244,7 @@ jobs:
- Azure
- Gcp
- Packet
+ - EquinixMetal
- Cloud
dotnet-version:
- 3.1.301

MODIFY
.github/workflows/smoke-test-cli-command.yml
.github/workflows/smoke-test-cli-command.yml
@@ -193,6 +193,7 @@ jobs:
- Azure
- Gcp
- Packet
+ - EquinixMetal
- Cloud
dotnet-version:
- 3.1.301

ADD
equinix-metal-py-webserver/.gitignore
+/bin/

ADD
equinix-metal-py-webserver/Pulumi.yaml
+name: equinix-metal-py-webserver
+description: A simple server on Equinix Metal.
+runtime: python

ADD
equinix-metal-py-webserver/README.md
+[![Deploy](https://get.pulumi.com/new/button.svg)](https://app.pulumi.com/new)
+
+# Equinix Metal Webserver
+
+This example demonstrates creating a webserver in Equinix Metal with Python
+
+# Running the Example
+
+After cloning this repo, `cd` into it and run these commands.
+
+1. Create a new stack, which is an isolated deployment target for this example:
+
+ ```bash
+ $ pulumi stack init
+ ```
+
+1. Install all of the dependencies for the application:
+
+1. Create a Python virtualenv, activate it, and install dependencies:
+
+ This installs the dependent packages [needed](https://www.pulumi.com/docs/intro/concepts/how-pulumi-works/) for our Pulumi program.
+
+ ```bash
+ $ python3 -m venv venv
+ $ source venv/bin/activate
+ $ pip3 install -r requirements.txt
+ ```
+
+1. Deploy everything with the `pulumi up` command. This provisions the webserver:
+
+ ```bash
+ $ pulumi up
+ ```
+
+1. After a couple minutes, your webserver will be ready.
+
+ ```bash
+ $ pulumi up
+ ...
+
+ Outputs:
+ + ip : "147.75.65.213"
+ + name: "new-vervet"
+ ```
+
+1. Once you are done, you can destroy all of the resources, and the stack:
+
+ ```bash
+ $ pulumi destroy
+ $ pulumi stack rm
+ ```

ADD
equinix-metal-py-webserver/__main__.py
+import pulumi_equinix_metal as metal
+import pulumi_random as random
+from pulumi import export
+
+random_host_name = random.RandomPet("hostname")
+
+project = metal.get_project(
+ name="ci-project"
+)
+
+vm = metal.Device(
+ "vm",
+ billing_cycle="hourly",
+ facilities=["ewr1"],
+ hostname=random_host_name.id,
+ operating_system="coreos_stable",
+ plan="baremetal_0",
+ project_id=project.id,
+ ip_addresses=[{
+ "type": "public_ipv4",
+ }, {
+ "type": "private_ipv4",
+ }]
+)
+
+export('ip', vm.access_public_ipv4)
+export('name', vm.hostname)

ADD
equinix-metal-py-webserver/requirements.txt
+pulumi>=2.0.0,<3.0.0
+pulumi-equinix-metal>=1.0.0,<2.0.0
+pulumi-random>=2.0.0,<3.0.0

ADD
equinix-metal-ts-webserver/Pulumi.yaml
+name: webserver-equinix-metal
+description: A simple server on Equinix Metal.
+runtime: nodejs
+

ADD
equinix-metal-ts-webserver/README.md
+[![Deploy](https://get.pulumi.com/new/button.svg)](https://app.pulumi.com/new)
+
+# Equinix Metal Webserver
+
+This example demonstrates creating a webserver in Equinix Metal
+
+# Running the Example
+
+After cloning this repo, `cd` into it and run these commands.
+
+1. Create a new stack, which is an isolated deployment target for this example:
+
+ ```bash
+ $ pulumi stack init
+ ```
+
+1. Install all of the dependencies for the application:
+
+ ```bash
+ $ npm install
+ ```
+
+1. Deploy everything with the `pulumi up` command. This provisions the webserver:
+
+ ```bash
+ $ pulumi up
+ ```
+
+1. After a couple minutes, your webserver will be ready.
+
+ ```bash
+ $ pulumi up
+ ...
+
+ Outputs:
+ + ip : "147.75.65.213"
+ + name: "new-vervet"
+ ```
+
+1. Once you are done, you can destroy all of the resources, and the stack:
+
+ ```bash
+ $ pulumi destroy
+ $ pulumi stack rm
+ ```

ADD
equinix-metal-ts-webserver/index.ts
+// Copyright 2016-2019, Pulumi Corporation. All rights reserved.
+
+import * as metal from "@pulumi/equinix-metal";
+import * as random from "@pulumi/random";
+
+const randomHostName = new random.RandomPet("hostname");
+
+const project = metal.getProject({name: "ci-project"});
+
+const vm = new metal.Device("vm", {
+ facilities: [metal.Facility.EWR1],
+ billingCycle: metal.BillingCycle.Hourly,
+ hostname: randomHostName.id,
+ operatingSystem: metal.OperatingSystem.CoreOSStable,
+ plan: metal.Plan.T1SmallX86,
+ projectId: project.then(p => p.id),
+ ipAddresses: [{
+ type: "public_ipv4",
+ },
+ {
+ type: "private_ipv4",
+ }],
+});
+
+export const ip = vm.accessPublicIpv4;
+export const name = vm.hostname;

ADD
equinix-metal-ts-webserver/package.json
+{
+ "name": "equinix-metal-ts-webserver",
+ "version": "0.1.0",
+ "devDependencies": {
+ "@types/node": "^8.0.0"
+ },
+ "dependencies": {
+ "@pulumi/equinix-metal": "^1.0.0",
+ "@pulumi/random": "latest"
+ },
+ "license": "Apache-2.0"
+}

ADD
equinix-metal-ts-webserver/tsconfig.json
+{
+ "compilerOptions": {
+ "outDir": "bin",
+ "target": "es6",
+ "module": "commonjs",
+ "moduleResolution": "node",
+ "sourceMap": true,
+ "stripInternal": true,
+ "experimentalDecorators": true,
+ "pretty": true,
+ "noFallthroughCasesInSwitch": true,
+ "noImplicitAny": true,
+ "noImplicitReturns": true,
+ "forceConsistentCasingInFileNames": true,
+ "strictNullChecks": true
+ },
+ "files": [
+ "index.ts"
+ ]
+}
+

RENAME
misc/test/packet_test.go
misc/test/equinix_metal_test.go
-// +build packet all
+// +build equinix_metal all
package test
@@ -18,6 +18,15 @@ func TestAccPacketPyWebserver(t *testing.T) {
integration.ProgramTest(t, &test)
}
+func TestAccEquinixMetalPyWebserver(t *testing.T) {
+ test := getBaseOptions(t).
+ With(integration.ProgramTestOptions{
+ Dir: path.Join(getCwd(t), "..", "..", "equinix-metal-py-webserver"),
+ })
+
+ integration.ProgramTest(t, &test)
+}
+
func TestAccPacketTsWebserver(t *testing.T) {
test := getBaseOptions(t).
With(integration.ProgramTestOptions{
@@ -26,3 +35,12 @@ func TestAccPacketTsWebserver(t *testing.T) {
integration.ProgramTest(t, &test)
}
+
+func TestAccEquinixMetalTsWebserver(t *testing.T) {
+ test := getBaseOptions(t).
+ With(integration.ProgramTestOptions{
+ Dir: path.Join(getCwd(t), "..", "..", "equinix-metal-ts-webserver"),
+ })
+
+ integration.ProgramTest(t, &test)
+}

Adding Equinix Metal examples equivalent to Packet.net to help with provider deprecation (#907)