Skip to content

Commit

Permalink
update terraform provider
Browse files Browse the repository at this point in the history
  • Loading branch information
philipkrueck committed Apr 9, 2024
1 parent 70c3d3d commit 332bb2c
Show file tree
Hide file tree
Showing 14 changed files with 49 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ VERSION_PATH := ${PROVIDER_PATH}/pkg/version.Version
TFGEN := pulumi-tfgen-${PACK}
PROVIDER := pulumi-resource-${PACK}

VERSION := v0.0.11
VERSION := v0.0.12

TESTPARALLELISM := 4

Expand Down
11 changes: 11 additions & 0 deletions docs/installation_configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@ The Pulumi Genesis Cloud provider is available as a package in the following lan
- JavaScript/TypeScript: [`@genesiscloud/pulumi-genesiscloud`](https://www.npmjs.com/package/@genesiscloud/pulumi-genesiscloud)
- Python: [`pulumi-genesiscloud`](https://pypi.org/project/pulumi-genesiscloud/)
- Go: [`github.com/genesiscloud/pulumi-genesiscloud/sdk/go/genesiscloud`](https://pkg.go.dev/github.com/pulumi/pulumi-genesiscloud/sdk)
- Dotnet: ...

### Provider Binary

The Genesis Cloud provider binary is a third party binary. It can be installed using the pulumi plugin command.

```bash
pulumi plugin install resource genesiscloud <version> --server https://github.com/genesiscloud/pulumi-genesiscloud/releases/download/<version>
```

Replace the version string with your desired version.

## Setup

Expand Down
2 changes: 1 addition & 1 deletion genesiscloudshim/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ toolchain go1.22.1
replace github.com/hashicorp/terraform-plugin-sdk/v2 => github.com/pulumi/terraform-plugin-sdk/v2 v2.0.0-20230912190043-e6d96b3b8f7e

require (
github.com/genesiscloud/terraform-provider-genesiscloud v1.1.3
github.com/genesiscloud/terraform-provider-genesiscloud v1.1.4
github.com/hashicorp/terraform-plugin-framework v1.7.0
)

Expand Down
4 changes: 2 additions & 2 deletions genesiscloudshim/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM=
github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE=
github.com/genesiscloud/genesiscloud-go v1.0.7 h1:bew0WlAeZjxJeQ8fGDsk9KVtI2yoPwiBe5PRzMY1Zdw=
github.com/genesiscloud/genesiscloud-go v1.0.7/go.mod h1:OAMjSCejQTC4BBLWXleegT/fg+X46SZ6t/vW9RPtXWg=
github.com/genesiscloud/terraform-provider-genesiscloud v1.1.3 h1:zurDa/HFhtQyngXu6T1p9002mPIMFOfybL5xy6xu0XU=
github.com/genesiscloud/terraform-provider-genesiscloud v1.1.3/go.mod h1:HTAyCsunAu5oXKMEucmWvsFF4oVsf2k8o5VJ50mDtTc=
github.com/genesiscloud/terraform-provider-genesiscloud v1.1.4 h1:HMrZe2PnIbrj7fklJzCJXSjrOYUjHNSjL9Yq251idBY=
github.com/genesiscloud/terraform-provider-genesiscloud v1.1.4/go.mod h1:HTAyCsunAu5oXKMEucmWvsFF4oVsf2k8o5VJ50mDtTc=
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
Expand Down
8 changes: 5 additions & 3 deletions provider/cmd/pulumi-resource-genesiscloud/schema.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "genesiscloud",
"displayName": "Genesis Cloud",
"version": "v0.0.11",
"version": "v0.0.12",
"description": "A Pulumi package for creating and managing genesiscloud cloud resources.",
"keywords": ["pulumi", "genesiscloud", "category/cloud"],
"homepage": "https://www.pulumi.io",
Expand Down Expand Up @@ -42,7 +42,8 @@
"variables": {
"endpoint": {
"type": "string",
"description": "Genesis Cloud API endpoint. May also be provided via `GENESISCLOUD_ENDPOINT` environment variable. If neither is\nprovided, defaults to `https://api.genesiscloud.com/compute/v1`.\n"
"description": "Genesis Cloud API endpoint. May also be provided via `GENESISCLOUD_ENDPOINT` environment variable. If neither is\nprovided, defaults to `https://api.genesiscloud.com/compute/v1`.\n",
"defaultInfo": { "environment": ["GENESISCLOUD_ENDPOINT"] }
},
"pollingInterval": {
"type": "string",
Expand Down Expand Up @@ -316,7 +317,8 @@
"inputProperties": {
"endpoint": {
"type": "string",
"description": "Genesis Cloud API endpoint. May also be provided via `GENESISCLOUD_ENDPOINT` environment variable. If neither is\nprovided, defaults to `https://api.genesiscloud.com/compute/v1`.\n"
"description": "Genesis Cloud API endpoint. May also be provided via `GENESISCLOUD_ENDPOINT` environment variable. If neither is\nprovided, defaults to `https://api.genesiscloud.com/compute/v1`.\n",
"defaultInfo": { "environment": ["GENESISCLOUD_ENDPOINT"] }
},
"pollingInterval": {
"type": "string",
Expand Down
2 changes: 1 addition & 1 deletion provider/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ require (
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/gedex/inflector v0.0.0-20170307190818-16278e9db813 // indirect
github.com/genesiscloud/genesiscloud-go v1.0.7 // indirect
github.com/genesiscloud/terraform-provider-genesiscloud v1.1.3 // indirect
github.com/genesiscloud/terraform-provider-genesiscloud v1.1.4 // indirect
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
github.com/go-git/go-billy/v5 v5.5.0 // indirect
github.com/go-git/go-git/v5 v5.11.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions provider/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -787,8 +787,8 @@ github.com/gedex/inflector v0.0.0-20170307190818-16278e9db813 h1:Uc+IZ7gYqAf/rSG
github.com/gedex/inflector v0.0.0-20170307190818-16278e9db813/go.mod h1:P+oSoE9yhSRvsmYyZsshflcR6ePWYLql6UU1amW13IM=
github.com/genesiscloud/genesiscloud-go v1.0.7 h1:bew0WlAeZjxJeQ8fGDsk9KVtI2yoPwiBe5PRzMY1Zdw=
github.com/genesiscloud/genesiscloud-go v1.0.7/go.mod h1:OAMjSCejQTC4BBLWXleegT/fg+X46SZ6t/vW9RPtXWg=
github.com/genesiscloud/terraform-provider-genesiscloud v1.1.3 h1:zurDa/HFhtQyngXu6T1p9002mPIMFOfybL5xy6xu0XU=
github.com/genesiscloud/terraform-provider-genesiscloud v1.1.3/go.mod h1:HTAyCsunAu5oXKMEucmWvsFF4oVsf2k8o5VJ50mDtTc=
github.com/genesiscloud/terraform-provider-genesiscloud v1.1.4 h1:HMrZe2PnIbrj7fklJzCJXSjrOYUjHNSjL9Yq251idBY=
github.com/genesiscloud/terraform-provider-genesiscloud v1.1.4/go.mod h1:HTAyCsunAu5oXKMEucmWvsFF4oVsf2k8o5VJ50mDtTc=
github.com/getkin/kin-openapi v0.76.0/go.mod h1:660oXbgy5JFMKreazJaQTw7o+X00qeSyhcnluiMv+Xg=
github.com/getsentry/raven-go v0.2.0/go.mod h1:KungGk8q33+aIAZUIVWZDr2OfAEBsO49PX4NzFV5kcQ=
github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
Expand Down
5 changes: 5 additions & 0 deletions provider/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ func Provider() tfbridge.ProviderInfo {
EnvVars: []string{"GENESISCLOUD_TOKEN"},
},
},
"endpoint": {
Default: &tfbridge.DefaultInfo{
EnvVars: []string{"GENESISCLOUD_ENDPOINT"},
},
},
// Add any rquired configuration here, or remove the example below if
// no additional points are required.
// "region": {
Expand Down
10 changes: 9 additions & 1 deletion sdk/go/genesiscloud/config/config.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions sdk/go/genesiscloud/provider.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion sdk/nodejs/config/vars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const __config = new pulumi.Config("genesiscloud");
export declare const endpoint: string | undefined;
Object.defineProperty(exports, "endpoint", {
get() {
return __config.get("endpoint");
return __config.get("endpoint") ?? utilities.getEnv("GENESISCLOUD_ENDPOINT");
},
enumerable: true,
});
Expand Down
2 changes: 1 addition & 1 deletion sdk/nodejs/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class Provider extends pulumi.ProviderResource {
let resourceInputs: pulumi.Inputs = {};
opts = opts || {};
{
resourceInputs["endpoint"] = args ? args.endpoint : undefined;
resourceInputs["endpoint"] = (args ? args.endpoint : undefined) ?? utilities.getEnv("GENESISCLOUD_ENDPOINT");
resourceInputs["pollingInterval"] = args ? args.pollingInterval : undefined;
resourceInputs["token"] = (args?.token ? pulumi.secret(args.token) : undefined) ?? utilities.getEnv("GENESISCLOUD_TOKEN");
}
Expand Down
2 changes: 1 addition & 1 deletion sdk/python/pulumi_genesiscloud/config/vars.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def endpoint(self) -> Optional[str]:
Genesis Cloud API endpoint. May also be provided via `GENESISCLOUD_ENDPOINT` environment variable. If neither is
provided, defaults to `https://api.genesiscloud.com/compute/v1`.
"""
return __config__.get('endpoint')
return __config__.get('endpoint') or _utilities.get_env('GENESISCLOUD_ENDPOINT')

@property
def polling_interval(self) -> Optional[str]:
Expand Down
4 changes: 4 additions & 0 deletions sdk/python/pulumi_genesiscloud/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ def __init__(__self__, *,
example "10s".
:param pulumi.Input[str] token: Genesis Cloud API token. May also be provided via `GENESISCLOUD_TOKEN` environment variable.
"""
if endpoint is None:
endpoint = _utilities.get_env('GENESISCLOUD_ENDPOINT')
if endpoint is not None:
pulumi.set(__self__, "endpoint", endpoint)
if polling_interval is not None:
Expand Down Expand Up @@ -135,6 +137,8 @@ def _internal_init(__self__,
raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource')
__props__ = ProviderArgs.__new__(ProviderArgs)

if endpoint is None:
endpoint = _utilities.get_env('GENESISCLOUD_ENDPOINT')
__props__.__dict__["endpoint"] = endpoint
__props__.__dict__["polling_interval"] = polling_interval
if token is None:
Expand Down

0 comments on commit 332bb2c

Please sign in to comment.