Skip to content

Commit

Permalink
feat: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
johanneswuerbach committed Nov 15, 2022
0 parents commit e09f107
Show file tree
Hide file tree
Showing 18 changed files with 23,224 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
*.dll
*.exe
.DS_Store
example.tf
terraform.tfplan
terraform.tfstate
bin/
dist/
modules-dev/
/pkg/
website/.vagrant
website/.bundle
website/build
website/node_modules
.vagrant/
*.backup
./*.tfstate
.terraform/
*.log
*.bak
*~
.*.swp
.idea
*.iml
*.test
*.iml

website/vendor

# Test exclusions
!command/test-fixtures/**/*.tfstate
!command/test-fixtures/**/.terraform/

# Keep windows files with windows line endings
*.winfile eol=crlf
60 changes: 60 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# 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:
extra_files:
- glob: 'terraform-registry-manifest.json'
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json'
name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS'
algorithm: sha256
signs:
- artifacts: checksum
args:
# if you are using this in 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:
extra_files:
- glob: 'terraform-registry-manifest.json'
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json'
# If you want to manually examine the release before its live, uncomment this line:
# draft: true
changelog:
skip: true
50 changes: 50 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
CURRENT_VERSION := 0.0.1

uname_s := $(shell uname -s)
uname_m := $(shell uname -m)
l_uname_s = $(shell echo $(uname_s) | tr A-Z a-z)
l_uname_m = $(shell echo $(uname_m) | tr A-Z a-z)

KERNEL=$(l_uname_s)
ARCH=$(l_uname_m)


.PHONY: build info fmt vet test clean local-dev-install testacc

all: build

info:
@echo "Global info"
@echo "$(KERNEL)"
@echo "$(ARCH)"

fmt:
@echo " -> checking code style"
@! gofmt -d $(shell find . -path ./vendor -prune -o -name '*.go' -print) | grep '^'

vet:
@echo " -> vetting code"
@go vet ./...

build: clean
@echo " -> Building"
mkdir -p bin
CGO_ENABLED=0 go build -trimpath -o bin/terraform-provider-humanitec
@echo "Built terraform-provider-humanitec"

# Run acceptance tests
testacc:
TF_ACC=1 go test ./... -v $(TESTARGS) -timeout 120m

local-dev-install: build
@echo "Building this release $(CURRENT_VERSION) on $(KERNEL)/$(ARCH)"
rm -rf ~/.terraform.d/plugins/registry.terraform.io/humanitec/humanitec
mkdir -p ~/.terraform.d/plugins/registry.terraform.io/humanitec/humanitec/$(CURRENT_VERSION)/$(KERNEL)_$(ARCH)/
cp bin/terraform-provider-humanitec ~/.terraform.d/plugins/registry.terraform.io/humanitec/humanitec/$(CURRENT_VERSION)/$(KERNEL)_$(ARCH)/

install: build
cp bin/terraform-provider-humanitec $$GOPATH/bin/terraform-provider-humanitec

clean:
# @git clean -f -d
@echo "Clean"
50 changes: 50 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Terraform Provider Humanitec

## Requirements

- [Terraform](https://www.terraform.io/downloads.html) >= 1.0
- [Go](https://golang.org/doc/install) >= 1.18

## Building The Provider

1. Clone the repository
1. Enter the repository directory
1. Build the provider using the Go `install` command:

```shell
go install
```

## Adding Dependencies

This provider uses [Go modules](https://github.com/golang/go/wiki/Modules).
Please see the Go documentation for the most up to date information about using Go modules.

To add a new dependency `github.com/author/dependency` to your Terraform provider:

```shell
go get github.com/author/dependency
go mod tidy
```

Then commit the changes to `go.mod` and `go.sum`.

## Using the provider

Fill this in for each provider

## Developing the Provider

If you wish to work on the provider, you'll first need [Go](http://www.golang.org) installed on your machine (see [Requirements](#requirements) above).

To compile the provider, run `go install`. This will build the provider and put the provider binary in the `$GOPATH/bin` directory.

To generate or update documentation, run `go generate`.

In order to run the full suite of Acceptance tests, run `make testacc`.

*Note:* Acceptance tests create real resources, and often cost money to run.

```shell
make testacc
```
31 changes: 31 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "humanitec Provider"
subcategory: ""
description: |-
---

# humanitec Provider



## Example Usage

```terraform
provider "humanitec" {
# example configuration here
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `org_id` (String)
- `token` (String, Sensitive)

### Optional

- `host` (String) Example provider attribute
63 changes: 63 additions & 0 deletions docs/resources/resource_definition.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "humanitec_resource_definition Resource - terraform-provider-humanitec"
subcategory: ""
description: |-
---

# humanitec_resource_definition (Resource)



## Example Usage

```terraform
resource "humanitec_resource_definition" "s3" {
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `driver_type` (String)
- `name` (String)
- `type` (String)

### Optional

- `criteria` (Attributes List) (see [below for nested schema](#nestedatt--criteria))
- `driver_account` (String)
- `driver_inputs` (Attributes) (see [below for nested schema](#nestedatt--driver_inputs))

### Read-Only

- `id` (String) The ID of this resource.

<a id="nestedatt--criteria"></a>
### Nested Schema for `criteria`

Required:

- `id` (String)

Optional:

- `app_id` (String)
- `env_id` (String)
- `env_type` (String)
- `res_id` (String)


<a id="nestedatt--driver_inputs"></a>
### Nested Schema for `driver_inputs`

Optional:

- `secrets` (Map of String, Sensitive)
- `values` (Map of String)


3 changes: 3 additions & 0 deletions examples/provider/provider.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
provider "humanitec" {
# example configuration here
}
12 changes: 12 additions & 0 deletions examples/resources/humanitec_resource_definition/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
resource "humanitec_resource_definition" "s3" {
id = "test-s3"
name = "test-s3"
type = "s3"

driver_type = "humanitec/s3"
driver_inputs = {
values = {
region = "us-east-1"
}
}
}
62 changes: 62 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
module github.com/humanitec/terraform-provider-humanitec

go 1.19

require (
github.com/deepmap/oapi-codegen v1.12.2
github.com/hashicorp/terraform-plugin-docs v0.13.0
github.com/hashicorp/terraform-plugin-framework v0.15.0
)

require (
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/apapsch/go-jsonmerge/v2 v2.0.0 // indirect
github.com/armon/go-radix v1.0.0 // indirect
github.com/bgentry/speakeasy v0.1.0 // indirect
github.com/fatih/color v1.13.0 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-checkpoint v0.5.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-hclog v1.3.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/hc-install v0.4.0 // indirect
github.com/hashicorp/terraform-exec v0.17.2 // indirect
github.com/hashicorp/terraform-json v0.14.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.1.0 // indirect
github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 // indirect
github.com/hashicorp/yamux v0.1.1 // indirect
github.com/huandu/xstrings v1.3.2 // indirect
github.com/imdario/mergo v0.3.13 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.16 // indirect
github.com/mitchellh/cli v1.1.4 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/oklog/run v1.1.0 // indirect
github.com/posener/complete v1.2.3 // indirect
github.com/russross/blackfriday v1.6.0 // indirect
github.com/shopspring/decimal v1.3.1 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/vmihailenco/msgpack/v4 v4.3.12 // indirect
github.com/vmihailenco/tagparser v0.1.2 // indirect
github.com/zclconf/go-cty v1.10.0 // indirect
golang.org/x/crypto v0.1.0 // indirect
golang.org/x/net v0.2.0 // indirect
golang.org/x/sys v0.2.0 // indirect
golang.org/x/text v0.4.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20221114212237-e4508ebdbee1 // indirect
google.golang.org/grpc v1.50.1 // indirect
google.golang.org/protobuf v1.28.1 // indirect
)
Loading

0 comments on commit e09f107

Please sign in to comment.