-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from rawdaGastan/development
Provider
- Loading branch information
Showing
15 changed files
with
1,338 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Go GitHub Actions | ||
|
||
on: | ||
push: | ||
branches: [ "main", "development" ] | ||
pull_request: | ||
branches: [ "main", "development" ] | ||
|
||
jobs: | ||
Explore-Packge: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install GO | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.19 | ||
|
||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v3 | ||
|
||
- name: staticcheck | ||
uses: dominikh/[email protected] | ||
|
||
- name: gofmt | ||
uses: Jerome1337/[email protected] | ||
with: | ||
gofmt-flags: '-l -d' | ||
|
||
- name: Test | ||
run: go test -v ./... | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
test: | ||
go test -v -vet=off ./... | ||
|
||
docs: | ||
go get github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs | ||
go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs | ||
|
||
init: | ||
terraform init | ||
|
||
apply: | ||
terraform apply | ||
|
||
plugin: clean | ||
@mkdir -p ~/.terraform.d/plugins/example.com/local/plugin/1.0.0/linux_amd64 | ||
|
||
build: plugin | ||
@go build -o ~/.terraform.d/plugins/example.com/local/plugin/1.0.0/linux_amd64 | ||
|
||
clean: | ||
rm ./.terraform -rf | ||
rm -f ./.terraform.lock.hcl | ||
rm -f terraform.tfstate | ||
rm -f terraform.tfstate.backup |
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,119 @@ | ||
# Terraform provider plugin | ||
|
||
This folder encapsulates the Terraform Provider that issues API calls to the [pkid](https://github.com/rawdaGastan/pkid). | ||
|
||
## Running the example | ||
|
||
To run the Terraform Provider locally there are a few steps to complete: | ||
|
||
Step 1: Make sure your pkid server is [running](https://github.com/rawdaGastan/pkid#how-to-run-locally) | ||
|
||
Step 2: Build the source code locally and move into the local terraform plugin folder: | ||
|
||
```bash | ||
mkdir -p ~/.terraform.d/plugins/example.com/local/plugin/1.0.0/linux_amd64 | ||
go build -o ~/.terraform.d/plugins/example.com/local/plugin/1.0.0/linux_amd64 | ||
``` | ||
|
||
Or: | ||
|
||
```bash | ||
make build | ||
``` | ||
|
||
> Note: The plugin folder may need to be created. | ||
Step 3: Initialize Terraform: | ||
|
||
```bash | ||
terraform init | ||
``` | ||
|
||
### Create | ||
|
||
- Run an apply via Terraform: | ||
|
||
```bash | ||
terraform apply | ||
``` | ||
|
||
The output generated should look similar to the following: | ||
|
||
```bash | ||
Apply complete! Resources: 2 added, 0 changed, 0 destroyed. | ||
|
||
Outputs: | ||
|
||
vm_1 = { | ||
"encrypt" = true | ||
"id" = "pkid_key" | ||
"key" = "key" | ||
"project" = "pkid" | ||
"timeouts" = null /* object */ | ||
"value" = "value" | ||
} | ||
|
||
vm_2 = { | ||
"encrypt" = true | ||
"id" = "pkid_key" | ||
"key" = "key" | ||
"project" = "pkid" | ||
"timeouts" = null /* object */ | ||
"value" = "value" | ||
} | ||
``` | ||
|
||
### Update | ||
|
||
- make a change in the resource | ||
- Run an apply via Terraform: | ||
|
||
```bash | ||
terraform apply | ||
``` | ||
|
||
The output generated should look similar to the following: | ||
|
||
```bash | ||
Apply complete! Resources: 0 added, 2 changed, 0 destroyed. | ||
|
||
Outputs: | ||
|
||
vm_1 = { | ||
"encrypt" = false | ||
"id" = "pkid_key" | ||
"key" = "key" | ||
"project" = "pkid" | ||
"timeouts" = null /* object */ | ||
"value" = "value" | ||
} | ||
|
||
vm_2 = { | ||
"encrypt" = false | ||
"id" = "pkid_key" | ||
"key" = "key" | ||
"project" = "pkid" | ||
"timeouts" = null /* object */ | ||
"value" = "value" | ||
} | ||
``` | ||
|
||
### Delete | ||
|
||
- delete via terraform | ||
|
||
```bash | ||
terraform destroy -target=plugin_pkid_key_query.vm_1 | ||
``` | ||
|
||
The output generated should look similar to the following: | ||
|
||
```bash | ||
Destroy complete! Resources: 1 destroyed. | ||
``` | ||
|
||
## Test | ||
|
||
```bash | ||
make test | ||
``` |
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 @@ | ||
1.0.0 |
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,21 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "plugin Provider" | ||
subcategory: "" | ||
description: |- | ||
--- | ||
|
||
# plugin Provider | ||
|
||
|
||
|
||
|
||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `seed` (String) seed for generating keys of provider service API. | ||
- `url` (String) server url of provider service API. |
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,42 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "plugin_pkid_key_query Resource - terraform-provider-plugin" | ||
subcategory: "" | ||
description: |- | ||
--- | ||
|
||
# plugin_pkid_key_query (Resource) | ||
|
||
|
||
|
||
|
||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `encrypt` (Boolean) | ||
- `key` (String) | ||
- `project` (String) | ||
- `value` (String) | ||
|
||
### Optional | ||
|
||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts)) | ||
|
||
### Read-Only | ||
|
||
- `id` (String) The ID of this resource. | ||
|
||
<a id="nestedblock--timeouts"></a> | ||
### Nested Schema for `timeouts` | ||
|
||
Optional: | ||
|
||
- `create` (String) | ||
- `delete` (String) | ||
- `update` (String) | ||
|
||
|
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,42 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "plugin_pkid_project_query Resource - terraform-provider-plugin" | ||
subcategory: "" | ||
description: |- | ||
--- | ||
|
||
# plugin_pkid_project_query (Resource) | ||
|
||
|
||
|
||
|
||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `encrypt` (Boolean) | ||
- `key` (String) | ||
- `project` (String) | ||
- `value` (String) | ||
|
||
### Optional | ||
|
||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts)) | ||
|
||
### Read-Only | ||
|
||
- `id` (String) The ID of this resource. | ||
|
||
<a id="nestedblock--timeouts"></a> | ||
### Nested Schema for `timeouts` | ||
|
||
Optional: | ||
|
||
- `create` (String) | ||
- `delete` (String) | ||
- `update` (String) | ||
|
||
|
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,82 @@ | ||
module github.com/rawdaGastan/terraform-provider-plugin | ||
|
||
go 1.19 | ||
|
||
require ( | ||
github.com/hashicorp/terraform-plugin-sdk v1.17.2 | ||
github.com/rawdaGastan/pkid v0.0.0-20221117155256-e0c59444a3ef | ||
) | ||
|
||
require ( | ||
cloud.google.com/go v0.65.0 // indirect | ||
cloud.google.com/go/storage v1.10.0 // indirect | ||
github.com/GoKillers/libsodium-go v0.0.0-20171022220152-dd733721c3cb // indirect | ||
github.com/Masterminds/goutils v1.1.1 // indirect | ||
github.com/Masterminds/semver/v3 v3.1.1 // indirect | ||
github.com/Masterminds/sprig/v3 v3.2.2 // indirect | ||
github.com/agext/levenshtein v1.2.2 // indirect | ||
github.com/apparentlymart/go-cidr v1.1.0 // indirect | ||
github.com/apparentlymart/go-textseg/v12 v12.0.0 // indirect | ||
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect | ||
github.com/armon/go-radix v1.0.0 // indirect | ||
github.com/aws/aws-sdk-go v1.37.0 // indirect | ||
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect | ||
github.com/bgentry/speakeasy v0.1.0 // indirect | ||
github.com/fatih/color v1.13.0 // indirect | ||
github.com/gokillers/libsodium-go v0.0.0-20171022220152-dd733721c3cb // indirect | ||
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect | ||
github.com/golang/protobuf v1.4.2 // indirect | ||
github.com/google/go-cmp v0.5.8 // indirect | ||
github.com/google/uuid v1.3.0 // indirect | ||
github.com/googleapis/gax-go/v2 v2.0.5 // indirect | ||
github.com/hashicorp/errwrap v1.1.0 // indirect | ||
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect | ||
github.com/hashicorp/go-getter v1.5.3 // indirect | ||
github.com/hashicorp/go-hclog v0.9.2 // indirect | ||
github.com/hashicorp/go-multierror v1.1.1 // indirect | ||
github.com/hashicorp/go-plugin v1.3.0 // indirect | ||
github.com/hashicorp/go-safetemp v1.0.0 // indirect | ||
github.com/hashicorp/go-uuid v1.0.3 // indirect | ||
github.com/hashicorp/go-version v1.6.0 // indirect | ||
github.com/hashicorp/hcl/v2 v2.8.2 // indirect | ||
github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 // indirect | ||
github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d // indirect | ||
github.com/huandu/xstrings v1.3.2 // indirect | ||
github.com/imdario/mergo v0.3.13 // indirect | ||
github.com/jmespath/go-jmespath v0.4.0 // indirect | ||
github.com/jstemmer/go-junit-report v0.9.1 // indirect | ||
github.com/klauspost/compress v1.11.2 // indirect | ||
github.com/mattn/go-colorable v0.1.12 // indirect | ||
github.com/mattn/go-isatty v0.0.14 // indirect | ||
github.com/mitchellh/cli v1.1.4 // indirect | ||
github.com/mitchellh/copystructure v1.2.0 // indirect | ||
github.com/mitchellh/go-homedir v1.1.0 // indirect | ||
github.com/mitchellh/go-testing-interface v1.0.4 // indirect | ||
github.com/mitchellh/go-wordwrap v1.0.0 // indirect | ||
github.com/mitchellh/mapstructure v1.1.2 // indirect | ||
github.com/mitchellh/reflectwalk v1.0.2 // indirect | ||
github.com/oklog/run v1.0.0 // indirect | ||
github.com/posener/complete v1.2.3 // indirect | ||
github.com/shopspring/decimal v1.3.1 // indirect | ||
github.com/spf13/afero v1.2.2 // indirect | ||
github.com/spf13/cast v1.5.0 // indirect | ||
github.com/ulikunitz/xz v0.5.8 // indirect | ||
github.com/vmihailenco/msgpack/v4 v4.3.12 // indirect | ||
github.com/vmihailenco/tagparser v0.1.1 // indirect | ||
github.com/zclconf/go-cty v1.10.0 // indirect | ||
github.com/zclconf/go-cty-yaml v1.0.2 // indirect | ||
go.opencensus.io v0.22.4 // indirect | ||
golang.org/x/crypto v0.1.0 // indirect | ||
golang.org/x/lint v0.0.0-20200302205851-738671d3881b // indirect | ||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect | ||
golang.org/x/net v0.1.0 // indirect | ||
golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43 // indirect | ||
golang.org/x/sys v0.1.0 // indirect | ||
golang.org/x/text v0.4.0 // indirect | ||
golang.org/x/tools v0.1.12 // indirect | ||
google.golang.org/api v0.34.0 // indirect | ||
google.golang.org/appengine v1.6.6 // indirect | ||
google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d // indirect | ||
google.golang.org/grpc v1.32.0 // indirect | ||
google.golang.org/protobuf v1.25.0 // indirect | ||
) |
Oops, something went wrong.