-
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.
- Loading branch information
Kévin Masseix
committed
Nov 15, 2021
1 parent
49a0fcd
commit 2c309a6
Showing
19 changed files
with
1,288 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,40 @@ | ||
.DS_Store | ||
vendor | ||
|
||
terraform-provider-hashicups | ||
bin | ||
|
||
# Local .terraform directories | ||
**/.terraform/* | ||
|
||
# .tfstate files | ||
*.tfstate | ||
*.tfstate.* | ||
|
||
# Crash log files | ||
crash.log | ||
|
||
# Ignore any .tfvars files that are generated automatically for each Terraform run. Most | ||
# .tfvars files are managed as part of configuration and so should be included in | ||
# version control. | ||
# | ||
# example.tfvars | ||
|
||
# Ignore override files as they are usually used to override resources locally and so | ||
# are not checked in | ||
override.tf | ||
override.tf.json | ||
*_override.tf | ||
*_override.tf.json | ||
|
||
# Include override files you do wish to add to version control using negated pattern | ||
# | ||
# !example_override.tf | ||
|
||
# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan | ||
# example: *tfplan* | ||
|
||
# Ignore CLI configuration files | ||
.terraformrc | ||
terraform.rc | ||
terraform |
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,54 @@ | ||
# Visit https://goreleaser.com for documentation on how to customize this | ||
# behavior. | ||
before: | ||
hooks: | ||
# this is just an example and not a requirement for provider building/publishing | ||
- go mod tidy | ||
builds: | ||
- env: | ||
# goreleaser does not work with CGO, it could also complicate | ||
# usage by users in CI/CD systems like Terraform Cloud where | ||
# they are unable to install libraries. | ||
- CGO_ENABLED=0 | ||
mod_timestamp: "{{ .CommitTimestamp }}" | ||
flags: | ||
- -trimpath | ||
ldflags: | ||
- "-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}" | ||
goos: | ||
- freebsd | ||
- windows | ||
- linux | ||
- darwin | ||
goarch: | ||
- amd64 | ||
- "386" | ||
- arm | ||
- arm64 | ||
ignore: | ||
- goos: darwin | ||
goarch: "386" | ||
binary: "{{ .ProjectName }}_v{{ .Version }}" | ||
archives: | ||
- format: zip | ||
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" | ||
checksum: | ||
name_template: "{{ .ProjectName }}_{{ .Version }}_SHA256SUMS" | ||
algorithm: sha256 | ||
signs: | ||
- artifacts: checksum | ||
args: | ||
# if you are using this is a GitHub action or some other automated pipeline, you | ||
# need to pass the batch flag to indicate its not interactive. | ||
- "--batch" | ||
- "--local-user" | ||
- "{{ .Env.GPG_FINGERPRINT }}" # set this environment variable for your signing key | ||
- "--output" | ||
- "${signature}" | ||
- "--detach-sign" | ||
- "${artifact}" | ||
release: | ||
# If you want to manually examine the release before its live, uncomment this line: | ||
# draft: true | ||
changelog: | ||
skip: true |
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,37 @@ | ||
TEST?=$$(go list ./... | grep -v 'vendor') | ||
HOSTNAME=nua.ge | ||
NAMESPACE=terraform | ||
NAME=nuage | ||
BINARY=terraform-provider-${NAME} | ||
VERSION=0.0.1 | ||
OS_ARCH=linux_amd64 | ||
|
||
default: install | ||
|
||
build: | ||
go build -o ${BINARY} | ||
|
||
release: | ||
GOOS=darwin GOARCH=amd64 go build -o ./bin/${BINARY}_${VERSION}_darwin_amd64 | ||
GOOS=freebsd GOARCH=386 go build -o ./bin/${BINARY}_${VERSION}_freebsd_386 | ||
GOOS=freebsd GOARCH=amd64 go build -o ./bin/${BINARY}_${VERSION}_freebsd_amd64 | ||
GOOS=freebsd GOARCH=arm go build -o ./bin/${BINARY}_${VERSION}_freebsd_arm | ||
GOOS=linux GOARCH=386 go build -o ./bin/${BINARY}_${VERSION}_linux_386 | ||
GOOS=linux GOARCH=amd64 go build -o ./bin/${BINARY}_${VERSION}_linux_amd64 | ||
GOOS=linux GOARCH=arm go build -o ./bin/${BINARY}_${VERSION}_linux_arm | ||
GOOS=openbsd GOARCH=386 go build -o ./bin/${BINARY}_${VERSION}_openbsd_386 | ||
GOOS=openbsd GOARCH=amd64 go build -o ./bin/${BINARY}_${VERSION}_openbsd_amd64 | ||
GOOS=solaris GOARCH=amd64 go build -o ./bin/${BINARY}_${VERSION}_solaris_amd64 | ||
GOOS=windows GOARCH=386 go build -o ./bin/${BINARY}_${VERSION}_windows_386 | ||
GOOS=windows GOARCH=amd64 go build -o ./bin/${BINARY}_${VERSION}_windows_amd64 | ||
|
||
install: build | ||
mkdir -p ~/.terraform.d/plugins/${HOSTNAME}/${NAMESPACE}/${NAME}/${VERSION}/${OS_ARCH} | ||
mv ${BINARY} ~/.terraform.d/plugins/${HOSTNAME}/${NAMESPACE}/${NAME}/${VERSION}/${OS_ARCH} | ||
|
||
test: | ||
go test -i $(TEST) || exit 1 | ||
echo $(TEST) | xargs -t -n4 go test $(TESTARGS) -timeout=30s -parallel=4 | ||
|
||
testacc: | ||
TF_ACC=1 go test $(TEST) -v $(TESTARGS) -timeout 120m |
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,31 @@ | ||
# Terraform Provider Nuage | ||
|
||
[Nuage provider](https://nua.ge) based on Terraform Provider Hashicups | ||
|
||
## Build provider | ||
|
||
Run the following command to build the provider | ||
|
||
```shell | ||
$ go build -o terraform-provider-nuage | ||
``` | ||
|
||
## Test sample configuration | ||
|
||
First, build and install the provider. | ||
|
||
```shell | ||
$ make install | ||
``` | ||
|
||
Then, navigate to the `examples` directory. | ||
|
||
```shell | ||
$ cd examples | ||
``` | ||
|
||
Run the following command to initialize the workspace and apply the sample configuration. | ||
|
||
```shell | ||
$ terraform init && terraform apply | ||
``` |
Empty file.
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,17 @@ | ||
--- | ||
page_title: "Provider: Nuage" | ||
subcategory: "" | ||
description: Nuage Terraform provider | ||
--- | ||
|
||
# Nuage Provider | ||
|
||
## Example Usage | ||
|
||
```terraform | ||
provider "nuage" { | ||
name = "kevin masseix" | ||
password = "HelloWorld123" | ||
organization = "foobar" | ||
} | ||
``` |
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 @@ | ||
--- | ||
page_title: "project Resource - terraform-provider-nuage" | ||
subcategory: "" | ||
description: "" | ||
--- | ||
|
||
# Resource `nuage_project` | ||
|
||
## Example Usage | ||
|
||
```terraform | ||
resource "nuage_project" "project" { | ||
description = "projet infra" | ||
name = "infra00000000000" | ||
} | ||
``` | ||
|
||
## Argument Reference | ||
|
||
- `description` - (Required) Description of the project | ||
- `name` - (Required) Must be unique and match ^([a-z0-9]{16})$ |
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,2 @@ | ||
secret.tfvars | ||
.terraform* |
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,65 @@ | ||
terraform { | ||
required_providers { | ||
nuage = { | ||
source = "nua.ge/terraform/nuage" | ||
} | ||
} | ||
required_version = "~> 1.0.3" | ||
} | ||
|
||
provider "nuage" { | ||
name = var.nuage_auth_name | ||
password = var.nuage_auth_password | ||
organization = var.nuage_auth_organization | ||
} | ||
|
||
# resource "nuage_keypair" "keypair" { | ||
# description = "ssh key" | ||
# public_key = "abc" | ||
# user = "mkcg" | ||
# } | ||
|
||
resource "nuage_project" "project" { | ||
description = "projet infra" | ||
name = "infra00000000000" | ||
} | ||
|
||
resource "nuage_project" "project-bis" { | ||
description = "projet infra" | ||
name = "infra00000000001" | ||
} | ||
|
||
resource "nuage_project" "project-ter" { | ||
description = "projet infra" | ||
name = "infra00000000002" | ||
} | ||
|
||
|
||
# resource "nuage_security_rule" "sec-rule" { | ||
# direction = "in" | ||
# protocol = "tcp" | ||
# port_min = 80 | ||
# port_max = 80 | ||
# remote = "192.168.0.1/32" | ||
# } | ||
|
||
# resource "nuage_security_rule" "sec-rule-bis" { | ||
# direction = "in" | ||
# protocol = "tcp" | ||
# port_min = 443 | ||
# port_max = 443 | ||
# remote = "192.168.0.1/32" | ||
# } | ||
|
||
# resource "nuage_security_group" "sec-group" { | ||
# name = "internal" | ||
# description = "Used by internal users" | ||
# rules = [ | ||
# nuage_security_rule.sec-rule.id, | ||
# nuage_security_rule.sec-rule-bis.id | ||
# ] | ||
# } | ||
|
||
# output "sg" { | ||
# value = nuage_security_group.sec-group | ||
# } |
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,17 @@ | ||
variable "nuage_auth_organization" { | ||
type = string | ||
sensitive = true | ||
description = "Nuage organization" | ||
} | ||
|
||
variable "nuage_auth_name" { | ||
type = string | ||
sensitive = true | ||
description = "Nuage username" | ||
} | ||
|
||
variable "nuage_auth_password" { | ||
type = string | ||
sensitive = true | ||
description = "Nuage password" | ||
} |
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,8 @@ | ||
module terraform-provider-nuage | ||
|
||
go 1.16 | ||
|
||
require ( | ||
github.com/hashicorp-demoapp/hashicups-client-go v0.0.0-20210721190446-1df90c457bd4 | ||
github.com/hashicorp/terraform-plugin-framework v0.3.0 | ||
) |
Oops, something went wrong.