-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add initial code for gocd terraform provider
- Loading branch information
0 parents
commit 95d329e
Showing
16 changed files
with
887 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,20 @@ | ||
|
||
# dropping IDE data's | ||
.vscode | ||
.idea | ||
|
||
.DS_Store | ||
|
||
# dropping vendor and other data directories | ||
vendor/ | ||
|
||
# dropping local built binaries | ||
terraform-provider-demo | ||
terraform-provider-gocd* | ||
.terraform.* | ||
|
||
# dropping terraform plans and states | ||
terraform.tfstate* | ||
*.tfplan | ||
.terraform | ||
*.log |
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,45 @@ | ||
|
||
GOFMT_FILES?=$$(find . -not -path "./vendor/*" -type f -name '*.go') | ||
APP_NAME?=terraform-provider-gocd | ||
APP_DIR?=$$(git rev-parse --show-toplevel) | ||
SRC_PACKAGES=$(shell go list -mod=vendor ./... | grep -v "vendor" | grep -v "mocks") | ||
VERSION?=0.0.1 | ||
|
||
.PHONY: help | ||
help: ## Prints help (only for targets with comments) | ||
@grep -E '^[a-zA-Z0-9._-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; \ | ||
{printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' | ||
|
||
local.fmt: ## Lints all the go code in the application. | ||
gofmt -w $(GOFMT_FILES) | ||
|
||
local.check: local.fmt ## Loads all the dependencies to vendor directory | ||
go mod vendor | ||
go mod tidy | ||
|
||
local.build: local.check ## Generates the artifact with the help of 'go build' | ||
go build -o $(APP_NAME)_v$(VERSION) -ldflags="-s -w" | ||
|
||
local.push: local.build ## Pushes built artifact to the specified location | ||
|
||
local.run: local.build ## Generates the artifact and start the service in the current directory | ||
./${APP_NAME} | ||
|
||
lint: ## Lint's application for errors, it is a linters aggregator (https://github.com/golangci/golangci-lint). | ||
docker run --rm -v $(APP_DIR):/app -w /app golangci/golangci-lint:v1.31-alpine golangci-lint run --color always | ||
|
||
report: ## Publishes the go-report of the appliction (uses go-reportcard) | ||
docker run --rm -v $(APP_DIR):/app -w /app basnik/goreportcard-cli:latest goreportcard-cli -v | ||
|
||
dev.prerequisite.up: ## Sets up the development environment with all necessary components. | ||
$(APP_DIR)/scripts/prerequisite.sh | ||
|
||
generate.mock: ## generates mocks for the selected source packages. | ||
@go generate ${SRC_PACKAGES} | ||
|
||
create.newversion.tfregistry: local.build ## Sets up the local terraform registry with the version specified. | ||
@mkdir -p ~/terraform-providers/registry.terraform.io/hashicorp/gocd/$(VERSION)/darwin_arm64/ | ||
|
||
upload.newversion.provider: create.newversion.tfregistry ## Uploads the updated provider to local terraform registry. | ||
@rm -rf ~/terraform-providers/registry.terraform.io/hashicorp/gocd/$(VERSION)/darwin_arm64/terraform-provider-gocd_v$(VERSION) | ||
@cp terraform-provider-gocd_v$(VERSION) ~/terraform-providers/registry.terraform.io/hashicorp/gocd/$(VERSION)/darwin_arm64/ |
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,5 @@ | ||
terraform { | ||
backend "local" { | ||
path = "/Users/nikhil.bhat/terraform-backends/terraform-gocd-backend/terraform.tfstate" | ||
} | ||
} |
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,11 @@ | ||
resource "gocd_plugins" "json_plugin_settings" { | ||
plugin_id = "json.config.plugin" | ||
plugin_configurations { | ||
key = "pipeline_pattern" | ||
value = "*.gocdpipeline.test.json" | ||
} | ||
plugin_configurations { | ||
key = "environment_pattern" | ||
value = "*.gocdenvironment.test.json" | ||
} | ||
} |
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,15 @@ | ||
terraform { | ||
required_providers { | ||
gocd = { | ||
source = "hashicorp/gocd" | ||
version = "~> 0.0.1" | ||
} | ||
} | ||
} | ||
|
||
provider "gocd" { | ||
base_url = "http://localhost:8153/go" | ||
username = "admin" | ||
password = "admin" | ||
loglevel = "debug" | ||
} |
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,11 @@ | ||
resource "gocd_plugins" "yaml_plugin_settings" { | ||
plugin_id = "yaml.config.plugin" | ||
plugin_configurations { | ||
key = "file_pattern" | ||
value = "*.gocd.yaml" | ||
} | ||
plugin_configurations { | ||
key = "file_pattern" | ||
value = "*.gocd.yam" | ||
} | ||
} |
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,53 @@ | ||
module github.com/nikhilsbhat/terraform-provider-gocd | ||
|
||
go 1.19 | ||
|
||
require ( | ||
github.com/google/go-cmp v0.5.9 | ||
github.com/hashicorp/terraform-plugin-sdk/v2 v2.24.1 | ||
github.com/nikhilsbhat/gocd-sdk-go v0.0.2 | ||
) | ||
|
||
require ( | ||
github.com/agext/levenshtein v1.2.3 // indirect | ||
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect | ||
github.com/fatih/color v1.13.0 // indirect | ||
github.com/go-resty/resty/v2 v2.7.0 // indirect | ||
github.com/go-test/deep v1.0.8 // indirect | ||
github.com/golang/protobuf v1.5.2 // indirect | ||
github.com/hashicorp/errwrap v1.1.0 // indirect | ||
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 // indirect | ||
github.com/hashicorp/go-hclog v1.2.1 // indirect | ||
github.com/hashicorp/go-multierror v1.1.1 // indirect | ||
github.com/hashicorp/go-plugin v1.4.6 // 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.15.0 // indirect | ||
github.com/hashicorp/logutils v1.0.0 // indirect | ||
github.com/hashicorp/terraform-plugin-go v0.14.1 // indirect | ||
github.com/hashicorp/terraform-plugin-log v0.7.0 // indirect | ||
github.com/hashicorp/terraform-registry-address v0.0.0-20220623143253-7d51757b572c // indirect | ||
github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 // indirect | ||
github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d // indirect | ||
github.com/jinzhu/copier v0.3.5 // indirect | ||
github.com/mattn/go-colorable v0.1.12 // indirect | ||
github.com/mattn/go-isatty v0.0.14 // indirect | ||
github.com/mitchellh/copystructure v1.2.0 // indirect | ||
github.com/mitchellh/go-testing-interface v1.14.1 // indirect | ||
github.com/mitchellh/go-wordwrap v1.0.1 // indirect | ||
github.com/mitchellh/mapstructure v1.5.0 // indirect | ||
github.com/mitchellh/reflectwalk v1.0.2 // indirect | ||
github.com/oklog/run v1.0.0 // indirect | ||
github.com/sirupsen/logrus v1.8.1 // indirect | ||
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect | ||
github.com/vmihailenco/msgpack/v4 v4.3.12 // indirect | ||
github.com/vmihailenco/tagparser v0.1.1 // indirect | ||
github.com/zclconf/go-cty v1.12.1 // indirect | ||
golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect | ||
golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6 // indirect | ||
golang.org/x/text v0.3.7 // indirect | ||
google.golang.org/appengine v1.6.7 // indirect | ||
google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa // indirect | ||
google.golang.org/grpc v1.50.1 // indirect | ||
google.golang.org/protobuf v1.28.1 // indirect | ||
) |
Oops, something went wrong.