forked from Pryz/terraform-provider-ldap
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* arrange same as `terraform-provider-scaffolding`'s directories * rename set.NewSet -> set.New * cosme * ldap initialization changed to function from method * copy from terraform-provider-scaffolding/.gitignore * Support for Debuggable Provider Binaries * Add terraform-plugin-docs * Add docs * use goreleaser to build * Add editor config * update test
- Loading branch information
Showing
27 changed files
with
426 additions
and
110 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,13 @@ | ||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
charset = utf-8 | ||
|
||
[Makefile] | ||
indent_style = tab | ||
|
||
[*.yml] | ||
indent_style = space | ||
indent_size = 2 |
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 |
---|---|---|
@@ -1,28 +1,35 @@ | ||
# Compiled Object files, Static and Dynamic libs (Shared Objects) | ||
*.o | ||
*.a | ||
*.so | ||
|
||
# Folders | ||
_obj | ||
_test | ||
|
||
# Architecture specific extensions/prefixes | ||
*.[568vq] | ||
[568vq].out | ||
|
||
*.cgo1.go | ||
*.cgo2.c | ||
_cgo_defun.c | ||
_cgo_gotypes.go | ||
_cgo_export.* | ||
|
||
_testmain.go | ||
|
||
*.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 | ||
*.prof | ||
*.iml | ||
|
||
website/vendor | ||
|
||
# Test exclusions | ||
!command/test-fixtures/**/*.tfstate | ||
!command/test-fixtures/**/.terraform/ | ||
|
||
# main executable on linux | ||
terraform-provider-ldap | ||
/dist | ||
# Keep windows files with windows line endings | ||
*.winfile eol=crlf |
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,43 @@ | ||
before: | ||
hooks: | ||
- go mod download | ||
builds: | ||
- env: | ||
- CGO_ENABLED=0 | ||
mod_timestamp: '{{ .CommitTimestamp }}' | ||
flags: | ||
- -trimpath | ||
ldflags: | ||
- -s -w | ||
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: | ||
- "--batch" | ||
- "--local-user" | ||
- "{{ .Env.GPG_FINGERPRINT }}" | ||
- "--output" | ||
- "${signature}" | ||
- "--detach-sign" | ||
- "${artifact}" | ||
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,33 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Acceptance Tests", | ||
"type": "go", | ||
"request": "launch", | ||
"mode": "test", | ||
// this assumes your workspace is the root of the repo | ||
"program": "${fileDirname}", | ||
"env": { | ||
"TF_ACC": "1", | ||
}, | ||
"args": [], | ||
}, | ||
{ | ||
"name": "Debug - Attach External CLI", | ||
"type": "go", | ||
"request": "launch", | ||
"mode": "debug", | ||
// this assumes your workspace is the root of the repo | ||
"program": "${workspaceFolder}", | ||
"env": {}, | ||
"args": [ | ||
// pass the debug flag for reattaching | ||
"-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 |
---|---|---|
@@ -1,24 +1,18 @@ | ||
BINARY=terraform-provider-ldap | ||
PLUGIN_PATH=$(HOME)/.terraform.d/plugins/registry.terraform.io/elastic-infra/ldap/$(shell git describe --tags | tr -d v)/darwin_amd64 | ||
TEST_ENV := LDAP_HOST=localhost LDAP_PORT=389 LDAP_BIND_USER="cn=admin,dc=example,dc=com" LDAP_BIND_PASSWORD=admin | ||
VERSION := v1.1.0 | ||
|
||
.DEFAULT_GOAL: $(BINARY) | ||
|
||
$(BINARY): | ||
go build -o bin/$(BINARY) | ||
|
||
bootstrap: | ||
go install github.com/mitchellh/gox | ||
|
||
cross-build: | ||
rm -rf dist | ||
CGO_ENABLED=0 GOFLAGS="-trimpath" gox -osarch "linux/amd64 darwin/amd64" \ | ||
-output "dist/{{.OS}}_{{.Arch}}/$(BINARY)_$(VERSION)" \ | ||
-ldflags "-w -s" | ||
tar cvzf $(BINARY)_$(VERSION).tar.gz -C dist . | ||
install: $(BINARY) | ||
install -d $(PLUGIN_PATH) | ||
install -m 775 bin/$(BINARY) $(PLUGIN_PATH)/ | ||
|
||
test: | ||
go test -v | ||
go test -v ./... | ||
|
||
docker_test: | ||
$(TEST_ENV) go test -v | ||
$(TEST_ENV) 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
--- | ||
page_title: "LDAP Provider" | ||
subcategory: "" | ||
description: |- | ||
The LDAP provider provides resources to interact with a LDAP object. | ||
--- | ||
|
||
# LDAP Provider | ||
|
||
The LDAP provider provides resources to interact with a LDAP object. | ||
|
||
## Example Usage | ||
|
||
```terraform | ||
terraform { | ||
required_providers { | ||
ldap = { | ||
source = "elastic-infra/ldap" | ||
version = "~> 2.0" | ||
} | ||
} | ||
} | ||
provider "ldap" { | ||
ldap_host = "localhost" | ||
ldap_port = 389 | ||
bind_user = "cn=admin,dc=example,dc=com" | ||
bind_password = "admin" | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- **bind_password** (String) Password to authenticate the Bind user. | ||
- **bind_user** (String) Bind user to be used for authenticating on the LDAP server. | ||
- **ldap_host** (String) The LDAP server to connect to. | ||
|
||
### Optional | ||
|
||
- **ldap_port** (Number) The LDAP protocol port (default: 389). | ||
- **start_tls** (Boolean) Upgrade TLS to secure the connection (default: false). | ||
- **tls** (Boolean) Enable TLS encryption for LDAP (LDAPS) (default: false). | ||
- **tls_insecure** (Boolean) Don't verify server TLS certificate (default: false). | ||
- **use_tls** (Boolean, Deprecated) Use TLS to secure the connection (default: 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,60 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "ldap_object Resource - terraform-provider-ldap" | ||
subcategory: "" | ||
description: |- | ||
Provides a LDAP Object. | ||
--- | ||
|
||
# ldap_object (Resource) | ||
|
||
Provides a LDAP Object. | ||
|
||
## Example Usage | ||
|
||
```terraform | ||
resource "ldap_object" "users_example_com" { | ||
dn = "ou=users,dc=example,dc=com" | ||
object_classes = ["top", "organizationalUnit"] | ||
} | ||
resource "ldap_object" "a123456" { | ||
dn = "uid=a123456,${ldap_object.users_example_com.dn}" | ||
object_classes = ["inetOrgPerson", "posixAccount"] | ||
attributes = [ | ||
{ sn = "Doe" }, | ||
{ givenName = "John" }, | ||
{ cn = "John Doe" }, | ||
{ displayName = "Mr. John K. Doe, esq." }, | ||
{ mail = "[email protected]" }, | ||
{ mail = "[email protected]" }, | ||
{ userPassword = "password" }, | ||
{ uidNumber = "1234" }, | ||
{ gidNumber = "1234" }, | ||
{ homeDirectory = "/home/jdoe" }, | ||
{ loginShell = "/bin/bash" } | ||
] | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- **dn** (String) The Distinguished Name (DN) of the object, as the concatenation of its RDN (unique among siblings) and its parent's DN. | ||
- **object_classes** (Set of String) The set of classes this object conforms to (e.g. organizationalUnit, inetOrgPerson). | ||
|
||
### Optional | ||
|
||
- **attributes** (Set of Map of String) The map of attributes of this object; each attribute can be multi-valued. | ||
- **id** (String) The ID of this resource. | ||
|
||
## Import | ||
|
||
Import is supported using the following syntax: | ||
|
||
```shell | ||
$ export TF_LDAP_IMPORTER_PATH=a123456.tf | ||
$ terraform import ldap_object.a123456 uid=a123456,ou=users,dc=example,dc=com | ||
``` |
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 { | ||
ldap = { | ||
source = "elastic-infra/ldap" | ||
version = "~> 2.0" | ||
} | ||
} | ||
} | ||
|
||
provider "ldap" { | ||
ldap_host = "localhost" | ||
ldap_port = 389 | ||
bind_user = "cn=admin,dc=example,dc=com" | ||
bind_password = "admin" | ||
} |
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 @@ | ||
$ export TF_LDAP_IMPORTER_PATH=a123456.tf | ||
$ terraform import ldap_object.a123456 uid=a123456,ou=users,dc=example,dc=com |
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,22 @@ | ||
resource "ldap_object" "users_example_com" { | ||
dn = "ou=users,dc=example,dc=com" | ||
object_classes = ["top", "organizationalUnit"] | ||
} | ||
|
||
resource "ldap_object" "a123456" { | ||
dn = "uid=a123456,${ldap_object.users_example_com.dn}" | ||
object_classes = ["inetOrgPerson", "posixAccount"] | ||
attributes = [ | ||
{ sn = "Doe" }, | ||
{ givenName = "John" }, | ||
{ cn = "John Doe" }, | ||
{ displayName = "Mr. John K. Doe, esq." }, | ||
{ mail = "[email protected]" }, | ||
{ mail = "[email protected]" }, | ||
{ userPassword = "password" }, | ||
{ uidNumber = "1234" }, | ||
{ gidNumber = "1234" }, | ||
{ homeDirectory = "/home/jdoe" }, | ||
{ loginShell = "/bin/bash" } | ||
] | ||
} |
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
Oops, something went wrong.