Skip to content

Commit

Permalink
initial simplified version of the terraform provider
Browse files Browse the repository at this point in the history
  • Loading branch information
wasaga committed Sep 17, 2024
1 parent 097cf69 commit aa4cb10
Show file tree
Hide file tree
Showing 12 changed files with 1,466 additions and 0 deletions.
5 changes: 5 additions & 0 deletions example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.terraform
.terraform.lock.hcl
terraform.tfstate
terraform.tfstate.backup
terraform.tfvars
42 changes: 42 additions & 0 deletions example/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
terraform {
required_providers {
pomerium = {
source = "github.com/pomerium/enterprise-terraform-provider"
version = "0.0.1"
}
}
}

variable "pomerium_service_account_token" {
type = string
sensitive = true
}

provider "pomerium" {
api_url = "https://console-api.localhost.pomerium.io"
tls_insecure_skip_verify = true
service_account_token = var.pomerium_service_account_token
}

resource "pomerium_namespace" "test_namespace" {
name = "test-namespace"
parent_id = "9d8dbd2c-8cce-4e66-9c1f-c490b4a07243"
}

resource "pomerium_policy" "test_policy" {
name = "test-policy"
namespace_id = pomerium_namespace.test_namespace.id
ppl = <<EOF
- allow:
and:
- authenticated_user: true
EOF
}

resource "pomerium_route" "test_route" {
name = "test-route"
namespace_id = pomerium_namespace.test_namespace.id
from = "https://verify-tf.localhost.pomerium.io"
to = ["https://verify.pomerium.com"]
policies = [pomerium_policy.test_policy.id]
}
68 changes: 68 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
module github.com/pomerium/enterprise-terraform-provider

go 1.23.0

require (
github.com/docker/cli v26.1.4+incompatible
github.com/hashicorp/terraform-plugin-framework v1.11.0
github.com/hashicorp/terraform-plugin-log v0.9.0
github.com/pomerium/enterprise-client-go v0.18.1-0.20240903154554-9b855ec72cfd
github.com/rs/zerolog v1.33.0
github.com/stretchr/testify v1.9.0
google.golang.org/grpc v1.66.2
)

require (
cel.dev/expr v0.16.1 // indirect
github.com/caddyserver/certmagic v0.21.3 // indirect
github.com/caddyserver/zerossl v0.1.3 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/cncf/xds/go v0.0.0-20240905190251-b4127c9b8d78 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/envoyproxy/go-control-plane v0.13.0 // indirect
github.com/envoyproxy/protoc-gen-validate v1.1.0 // indirect
github.com/fatih/color v1.13.0 // indirect
github.com/go-jose/go-jose/v3 v3.0.3 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/btree v1.1.3 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-hclog v1.5.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-plugin v1.6.0 // indirect
github.com/hashicorp/go-uuid v1.0.3 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
github.com/hashicorp/terraform-plugin-go v0.23.0 // indirect
github.com/hashicorp/terraform-registry-address v0.2.3 // indirect
github.com/hashicorp/terraform-svchost v0.1.1 // indirect
github.com/hashicorp/yamux v0.1.1 // indirect
github.com/jxskiss/base62 v1.1.0 // indirect
github.com/klauspost/cpuid/v2 v2.2.8 // indirect
github.com/libdns/libdns v0.2.2 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mholt/acmez/v2 v2.0.2 // indirect
github.com/miekg/dns v1.1.62 // indirect
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
github.com/oklog/run v1.0.0 // indirect
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/pomerium/pomerium v0.27.0 // indirect
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
github.com/zeebo/blake3 v0.2.4 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/crypto v0.27.0 // indirect
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect
golang.org/x/mod v0.21.0 // indirect
golang.org/x/net v0.29.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/sys v0.25.0 // indirect
golang.org/x/text v0.18.0 // indirect
golang.org/x/tools v0.25.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
353 changes: 353 additions & 0 deletions go.sum

Large diffs are not rendered by default.

63 changes: 63 additions & 0 deletions grpclog.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package main

import (
"fmt"

"github.com/rs/zerolog"
)

type grpcLogger struct {
l zerolog.Logger
}

func (g grpcLogger) Info(args ...any) {
g.l.Trace().Msg(fmt.Sprint(args...))
}

func (g grpcLogger) Infoln(args ...any) {
g.l.Trace().Msg(fmt.Sprint(args...))
}

func (g grpcLogger) Infof(format string, args ...any) {
g.l.Trace().Msgf(format, args...)
}

func (g grpcLogger) Warning(args ...any) {
g.l.Trace().Msg(fmt.Sprint(args...))
}

func (g grpcLogger) Warningln(args ...any) {
g.l.Trace().Msg(fmt.Sprint(args...))
}

func (g grpcLogger) Warningf(format string, args ...any) {
g.l.Trace().Msgf(format, args...)
}

func (g grpcLogger) Error(args ...any) {
g.l.Trace().Msg(fmt.Sprint(args...))
}

func (g grpcLogger) Errorln(args ...any) {
g.l.Trace().Msg(fmt.Sprint(args...))
}

func (g grpcLogger) Errorf(format string, args ...any) {
g.l.Trace().Msgf(format, args...)
}

func (g grpcLogger) Fatal(args ...any) {
g.l.Trace().Msg(fmt.Sprint(args...))
}

func (g grpcLogger) Fatalln(args ...any) {
g.l.Trace().Msg(fmt.Sprint(args...))
}

func (g grpcLogger) Fatalf(format string, args ...any) {
g.l.Trace().Msgf(format, args...)
}

func (g grpcLogger) V(_ int) bool {
return true
}
Loading

0 comments on commit aa4cb10

Please sign in to comment.