https://github.com/galleybytes/terraform-operator-remote-controller
TFO tf resource event watcher
https://github.com/galleybytes/terraform-operator-remote-controller
Last synced: about 2 months ago
JSON representation
TFO tf resource event watcher
- Host: GitHub
- URL: https://github.com/galleybytes/terraform-operator-remote-controller
- Owner: GalleyBytes
- License: apache-2.0
- Created: 2023-03-04T05:22:06.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2025-01-09T18:33:54.000Z (6 months ago)
- Last Synced: 2025-02-17T11:16:40.147Z (5 months ago)
- Language: Go
- Size: 103 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Terraform Operator Remote Controller
This is another controller that listens to tf resource events. Add and update events will transmit the tf manifest to a TFO-API server.
## Usage
Set up the following environment vars for the API server:
```bash
CLIENT_NAME=foo-k8s-cluster
TFO_API_PROTOCOL=http
TFO_API_HOST=localhost
TFO_API_PORT=5001
TFO_API_LOGIN_USER=username
TFO_API_LOGIN_PASSWORD=password
```Make sure you're connected to a cluster:
```bash
KUBECONFIG=~/.kube/config
```> InCluster configuration is automatically configured when this binary runs in a kubernetes pod.
### RBAC
This will require `get` and `list` permissions to `terraforms` resources:
```yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: tforc
rules:
- apiGroups:
- tf.galleybytes.com
resources:
- terraforms
verbs:
- get
- list
```Additional rules can be added when defining a post job to run after a successful terraform workflow.
```yaml
# ADDITIONAL RULES
- apiGroups:
- batch
resources:
- jobs
verbs:
- '*'
- apiGroups:
- ""
resources:
- serviceaccounts
verbs:
- create
- get
- list
- apiGroups:
- rbac.authorization.k8s.io
resources:
- clusterrolebindings
verbs:
- create
- get
- list
- apiGroups:
- ""
resources:
- configmaps
verbs:
- '*'
```And run the binary or run an in-cluster container:
```bash
go run main.go
```