Skip to content

Commit aa13fe8

Browse files
author
Hayden Young
committed
feat: setting up
1 parent 60d80de commit aa13fe8

File tree

15 files changed

+2032
-60
lines changed

15 files changed

+2032
-60
lines changed

BUILD.md

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Build
2+
3+
## Locally
4+
5+
In order to build the provider locally for testing, you can use the included dev
6+
container setup in [`.devcontainer/`](./.devcontainer). Running it with VS Code
7+
is the easiest method, but you can also run it from a terminal:
8+
9+
```shell
10+
docker build . -f .devcontainer/Dockerfile -t dcps
11+
...
12+
docker run --rm -it -v $(pwd):/build -w /build dcps
13+
build@368612b0ea8c:/build$
14+
```
15+
16+
Once you're in the container, you can use the included [`Makefile`](./Makefile)
17+
to build the SDKs included (Node.js, Python, .NET Core and Golang) by running
18+
the `build` target.
19+
20+
```shell
21+
build@368612b0ea8c:/build$ make build
22+
...
23+
```
24+
25+
Once this has completed, you will see a `dotnet`, `go`, `nodejs` and `python`
26+
folder appear in the [`sdk`](./sdk) directory. These are the compiled/generated
27+
SDKs for use with Pulumi.
28+
29+
## Release
30+
31+
To make a release, there is a two-step process to go through. The first step is
32+
making tags for the releases.
33+
34+
```shell
35+
$ git tag v1.0.2 # used for the nodejs, python and dotnet releases
36+
$ git tag sdk/v1.0.2 # used for the golang release
37+
```
38+
39+
Then, you just need to push your tags.
40+
41+
```shell
42+
$ git push --tags
43+
```
44+
45+
Once done, [GitHub Actions](./.github/workflows/release.yaml) will take over and
46+
(assuming you have set up the required environment variables on GitHub's end)
47+
build & release the SDKs to NPM, PyPI, and NuGet.

Makefile

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
PROJECT_NAME := xyz Package
1+
PROJECT_NAME := netbox Package
22

33
SHELL := /bin/bash
4-
PACK := xyz
5-
ORG := pulumi
4+
PACK := netbox
5+
ORG := hbjydev
66
PROJECT := github.com/${ORG}/pulumi-${PACK}
77
NODE_MODULE_NAME := @pulumi/${PACK}
88
TF_NAME := ${PACK}
@@ -29,13 +29,13 @@ prepare::
2929
mv "provider/cmd/pulumi-resource-x${EMPTY_TO_AVOID_SED}yz" provider/cmd/pulumi-resource-${NAME}
3030

3131
if [[ "${OS}" != "Darwin" ]]; then \
32-
sed -i 's,github.com/pulumi/pulumi-xyz,${REPOSITORY},g' provider/go.mod; \
32+
sed -i 's,github.com/pulumi/pulumi-netbox,${REPOSITORY},g' provider/go.mod; \
3333
find ./ ! -path './.git/*' -type f -exec sed -i 's/[x]yz/${NAME}/g' {} \; &> /dev/null; \
3434
fi
3535

3636
# In MacOS the -i parameter needs an empty string to execute in place.
3737
if [[ "${OS}" == "Darwin" ]]; then \
38-
sed -i '' 's,github.com/pulumi/pulumi-xyz,${REPOSITORY},g' provider/go.mod; \
38+
sed -i '' 's,github.com/pulumi/pulumi-netbox,${REPOSITORY},g' provider/go.mod; \
3939
find ./ ! -path './.git/*' -type f -exec sed -i '' 's/[x]yz/${NAME}/g' {} \; &> /dev/null; \
4040
fi
4141

README-PROVIDER.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Foo Resource Provider
1+
# Netbox Resource Provider
22

3-
The Foo Resource Provider lets you manage [Foo](http://example.com) resources.
3+
The Netbox Resource Provider lets you manage [Netbox](https://netbox.dev) resources.
44

55
## Installing
66

@@ -11,46 +11,46 @@ This package is available for several languages/platforms:
1111
To use from JavaScript or TypeScript in Node.js, install using either `npm`:
1212

1313
```bash
14-
npm install @pulumi/foo
14+
npm install @hbjydev/pulumi-netbox
1515
```
1616

1717
or `yarn`:
1818

1919
```bash
20-
yarn add @pulumi/foo
20+
yarn add @hbjydev/pulumi-netbox
2121
```
2222

2323
### Python
2424

2525
To use from Python, install using `pip`:
2626

2727
```bash
28-
pip install pulumi_foo
28+
pip install pulumi_netbox
2929
```
3030

3131
### Go
3232

3333
To use from Go, use `go get` to grab the latest version of the library:
3434

3535
```bash
36-
go get github.com/pulumi/pulumi-foo/sdk/go/...
36+
go get github.com/hbjydev/pulumi-netbox/sdk/go/...
3737
```
3838

3939
### .NET
4040

4141
To use from .NET, install using `dotnet add package`:
4242

4343
```bash
44-
dotnet add package Pulumi.Foo
44+
dotnet add package HBJYDev.Netbox
4545
```
4646

4747
## Configuration
4848

4949
The following configuration points are available for the `foo` provider:
5050

51-
- `foo:apiKey` (environment: `FOO_API_KEY`) - the API key for `foo`
52-
- `foo:region` (environment: `FOO_REGION`) - the region in which to deploy resources
51+
- `netbox:apiToken` (environment: `FOO_API_KEY`) - the API key for `foo`
52+
- `netbox:hostname` (environment: `FOO_REGION`) - the region in which to deploy resources
5353

5454
## Reference
5555

56-
For detailed reference documentation, please visit [the Pulumi registry](https://www.pulumi.com/registry/packages/foo/api-docs/).
56+
For detailed reference documentation, please visit [the Pulumi registry](https://www.pulumi.com/registry/packages/netbox/api-docs/).

README.md

+16-16
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ From the templated repository:
5454
This will do the following:
5555
- rename folders in `provider/cmd` to `pulumi-resource-foo` and `pulumi-tfgen-foo`
5656
- replace dependencies in `provider/go.mod` to reflect your repository name
57-
- find and replace all instances of the boilerplate `xyz` with the `NAME` of your provider.
57+
- find and replace all instances of the boilerplate `netbox` with the `NAME` of your provider.
5858

5959
Note for third-party providers:
6060
- Make sure to set the correct GitHub organization/username in all files referencing your provider as a dependency:
@@ -359,7 +359,7 @@ before:
359359
hooks:
360360
- make tfgen
361361
builds:
362-
- binary: pulumi-resource-xyz
362+
- binary: pulumi-resource-netbox
363363
dir: provider
364364
goarch:
365365
- amd64
@@ -370,8 +370,8 @@ builds:
370370
- linux
371371
ignore: []
372372
ldflags:
373-
- -X github.com/pulumi/pulumi-xyz/provider/pkg/version.Version={{.Tag}}
374-
main: ./cmd/pulumi-resource-xyz/
373+
- -X github.com/pulumi/pulumi-netbox/provider/pkg/version.Version={{.Tag}}
374+
main: ./cmd/pulumi-resource-netbox/
375375
sort: asc
376376
use: git
377377
release:
@@ -396,18 +396,18 @@ dist
396396
├── artifacts.json
397397
├── config.yaml
398398
├── metadata.json
399-
├── pulumi-xyz_darwin_amd64_v1
400-
│ └── pulumi-resource-xyz
401-
├── pulumi-xyz_darwin_arm64
402-
│ └── pulumi-resource-xyz
403-
├── pulumi-xyz_linux_amd64_v1
404-
│ └── pulumi-resource-xyz
405-
├── pulumi-xyz_linux_arm64
406-
│ └── pulumi-resource-xyz
407-
├── pulumi-xyz_windows_amd64_v1
408-
│ └── pulumi-resource-xyz.exe
409-
└── pulumi-xyz_windows_arm64
410-
└── pulumi-resource-xyz.exe
399+
├── pulumi-netbox_darwin_amd64_v1
400+
│ └── pulumi-resource-netbox
401+
├── pulumi-netbox_darwin_arm64
402+
│ └── pulumi-resource-netbox
403+
├── pulumi-netbox_linux_amd64_v1
404+
│ └── pulumi-resource-netbox
405+
├── pulumi-netbox_linux_arm64
406+
│ └── pulumi-resource-netbox
407+
├── pulumi-netbox_windows_amd64_v1
408+
│ └── pulumi-resource-netbox.exe
409+
└── pulumi-netbox_windows_arm64
410+
└── pulumi-resource-netbox.exe
411411
```
412412
413413
Any of the provider binaries can be used to target the correct machine architecture

deployment-templates/.goreleaser.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ before:
55
hooks:
66
- make tfgen
77
builds:
8-
- binary: pulumi-resource-xyz
8+
- binary: pulumi-resource-netbox
99
dir: provider
1010
env:
1111
- CGO_ENABLED=0
@@ -18,8 +18,8 @@ builds:
1818
- linux
1919
ldflags:
2020
# The line below MUST align with the module in current provider/go.mod
21-
- -X github.com/your-org-name/pulumi-xyz/provider/pkg/version.Version={{.Tag }}
22-
main: ./cmd/pulumi-resource-xyz/
21+
- -X github.com/your-org-name/pulumi-netbox/provider/pkg/version.Version={{.Tag }}
22+
main: ./cmd/pulumi-resource-netbox/
2323
changelog:
2424
skip: true
2525
release:

examples/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
module github.com/pulumi/pulumi-xyz/examples
1+
module github.com/hbjydev/pulumi-netbox/examples
22

33
go 1.16

provider/cmd/pulumi-resource-xyz/main.go provider/cmd/pulumi-resource-netbox/main.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ import (
2020
_ "embed"
2121

2222
"github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge"
23-
xyz "github.com/pulumi/pulumi-xyz/provider"
24-
"github.com/pulumi/pulumi-xyz/provider/pkg/version"
23+
netbox "github.com/hbjydev/pulumi-netbox/provider"
24+
"github.com/hbjydev/pulumi-netbox/provider/pkg/version"
2525
)
2626

2727
//go:embed schema-embed.json
2828
var pulumiSchema []byte
2929

3030
func main() {
3131
// Modify the path to point to the new provider
32-
tfbridge.Main("xyz", version.Version, xyz.Provider(), pulumiSchema)
32+
tfbridge.Main("netbox", version.Version, netbox.Provider(), pulumiSchema)
3333
}

provider/cmd/pulumi-tfgen-xyz/main.go provider/cmd/pulumi-tfgen-netbox/main.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ package main
1616

1717
import (
1818
"github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen"
19-
xyz "github.com/pulumi/pulumi-xyz/provider"
20-
"github.com/pulumi/pulumi-xyz/provider/pkg/version"
19+
netbox "github.com/hbjydev/pulumi-netbox/provider"
20+
"github.com/hbjydev/pulumi-netbox/provider/pkg/version"
2121
)
2222

2323
func main() {
2424
// Modify the path to point to the new provider
25-
tfgen.Main("xyz", version.Version, xyz.Provider())
25+
tfgen.Main("netbox", version.Version, netbox.Provider())
2626
}

0 commit comments

Comments
 (0)