Skip to content

Commit bafc915

Browse files
authored
Saas 2965 preset api terraform management (#7)
1 parent 0b779c4 commit bafc915

24 files changed

+3160
-59
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,7 @@
2020
# Go workspace file
2121
go.work
2222
go.work.sum
23+
24+
/local/.terraform**
25+
/local/terraform.tfstate
26+
**/.terraform/**

.golangci.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ linters:
99
enable:
1010
- durationcheck
1111
- errcheck
12-
- exportloopref
12+
- copyloopvar
1313
- forcetypeassert
1414
- godot
1515
- gofmt
@@ -20,8 +20,8 @@ linters:
2020
- nilerr
2121
- predeclared
2222
- staticcheck
23-
- tenv
23+
- usetesting
2424
- unconvert
2525
- unparam
2626
- unused
27-
- vet
27+
- govet

.vscode/launch.json

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Debug Provider Administration",
6+
"type": "go",
7+
"request": "launch",
8+
"mode": "debug",
9+
"program": "${workspaceFolder}",
10+
"env": {},
11+
"args": [
12+
"--debug",
13+
]
14+
},
15+
]
16+
}

GNUmakefile

-6
This file was deleted.

Makefile

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
TEST?=$$(go list ./... | grep -v 'vendor')
2+
HOSTNAME=localhost
3+
NAMESPACE=quortex
4+
NAME=administration
5+
BINARY=terraform-provider-${NAME}_v${VERSION}
6+
VERSION=0.0.5
7+
OS_ARCH=$$(uname | tr '[:upper:]' '[:lower:]')_$$(uname -m)
8+
9+
default: install
10+
11+
build:
12+
go build -o ${BINARY}
13+
14+
15+
test :
16+
go test -v $(TEST) -coverprofile=coverage.out
17+
release:
18+
GOOS=darwin GOARCH=amd64 go build -o ./bin/${BINARY}_${VERSION}_darwin_amd64
19+
GOOS=darwin GOARCH=arm64 go build -o ./bin/${BINARY}_${VERSION}_darwin_arm64
20+
GOOS=freebsd GOARCH=386 go build -o ./bin/${BINARY}_${VERSION}_freebsd_386
21+
GOOS=freebsd GOARCH=amd64 go build -o ./bin/${BINARY}_${VERSION}_freebsd_amd64
22+
GOOS=freebsd GOARCH=arm go build -o ./bin/${BINARY}_${VERSION}_freebsd_arm
23+
GOOS=linux GOARCH=386 go build -o ./bin/${BINARY}_${VERSION}_linux_386
24+
GOOS=linux GOARCH=amd64 go build -o ./bin/${BINARY}_${VERSION}_linux_amd64
25+
GOOS=linux GOARCH=arm go build -o ./bin/${BINARY}_${VERSION}_linux_arm
26+
GOOS=openbsd GOARCH=386 go build -o ./bin/${BINARY}_${VERSION}_openbsd_386
27+
GOOS=openbsd GOARCH=amd64 go build -o ./bin/${BINARY}_${VERSION}_openbsd_amd64
28+
GOOS=solaris GOARCH=amd64 go build -o ./bin/${BINARY}_${VERSION}_solaris_amd64
29+
GOOS=windows GOARCH=386 go build -o ./bin/${BINARY}_${VERSION}_windows_386
30+
GOOS=windows GOARCH=amd64 go build -o ./bin/${BINARY}_${VERSION}_windows_amd64
31+
32+
install: build
33+
mkdir -p ~/.terraform.d/plugins/${HOSTNAME}/${NAMESPACE}/${NAME}/${VERSION}/${OS_ARCH}
34+
mv ${BINARY} ~/.terraform.d/plugins/${HOSTNAME}/${NAMESPACE}/${NAME}/${VERSION}/${OS_ARCH}

README.md

+70-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,70 @@
1-
# terraform-provider-administration
1+
# terraform-provider-administration
2+
The Terraform provider administration is a plugin for Terraform that allows some administration configuration of quortex solution.
3+
This provider is maintained internally by the Quortex team.
4+
5+
## Documentation
6+
7+
Full, comprehensive documentation is available on the Terraform website:
8+
9+
https://registry.terraform.io/providers/quortex/administration/latest/docs
10+
11+
## Build provider
12+
13+
Run the following command to build the provider
14+
15+
```shell
16+
$ go build -o terraform-provider-administraition
17+
```
18+
19+
## Test sample configuration
20+
21+
First, build and install the provider.
22+
23+
```shell
24+
$ make install
25+
```
26+
27+
Then, navigate to the `examples/development` directory.
28+
29+
```shell
30+
$ cd examples/development
31+
```
32+
33+
Then update the following variables according to your needs in the provider "administration", for instance in your `main.tf` or define the variables in `./local/terraform.tfvars`
34+
```jsonc
35+
provider "administration" {
36+
auth_server = "https://example.auth.server" //can be omitted to use default
37+
host = "http://localhost:8000" //can be omitted to use default
38+
client_id = "my_client_id"
39+
client_secret = "my_client_secret"
40+
}
41+
42+
```
43+
Run the following command to initialize the workspace and apply the sample configuration.
44+
45+
```shell
46+
$ terraform init && terraform apply
47+
```
48+
49+
## Run Terraform tests :
50+
51+
Inspired from : https://developer.hashicorp.com/terraform/tutorials/configuration-language/test
52+
Go into `./local`
53+
Change the configs for this right ones according the credentials in `./local/terraform.tfvars`.
54+
Change the variable `my_local_test_org` you want to test in `./local/tests/setup/main.tf`
55+
56+
To launch local test :
57+
Change in `main.go` : `Address: "localhost/quortex/administration",`
58+
59+
```shell
60+
$ make install
61+
```
62+
63+
Then :
64+
```shell
65+
$ terraform init && terraform apply
66+
```
67+
68+
## Tests acceptance (yet abandonned)
69+
70+
Test was inspired from this repo : https://github.com/hashicorp/terraform-provider-scaffolding-framework/tree/main

docs/resources/processing_presets.md

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "administration_processing_presets Resource - administration"
4+
subcategory: ""
5+
description: |-
6+
Manages a processing presets.
7+
---
8+
9+
# administration_processing_presets (Resource)
10+
11+
Manages a processing presets.
12+
13+
14+
15+
<!-- schema generated by tfplugindocs -->
16+
## Schema
17+
18+
### Required
19+
20+
- `name` (String) Name of the processing presets.
21+
22+
### Optional
23+
24+
- `audio_medias` (Attributes List) List of audio medias of the processing presets. (see [below for nested schema](#nestedatt--audio_medias))
25+
- `org` (String) Organization UUID of the processing presets needed for admin API.
26+
- `subtitle_medias` (Attributes List) List of subtitle medias of the processing presets. (see [below for nested schema](#nestedatt--subtitle_medias))
27+
- `type` (String) Type of the processing presets.
28+
- `video_medias` (Attributes List) List of video medias of the processing presets. (see [below for nested schema](#nestedatt--video_medias))
29+
30+
### Read-Only
31+
32+
- `uuid` (String) UUID of the processing presets.
33+
34+
<a id="nestedatt--audio_medias"></a>
35+
### Nested Schema for `audio_medias`
36+
37+
Optional:
38+
39+
- `audio_description` (Boolean) Audio description of the audio media.
40+
- `bitrate` (Number) Bitrate of the audio media.
41+
- `channels` (String) Channels of the audio media.
42+
- `codec` (String) Codec of the audio media.
43+
- `label` (String) Label of the audio media.
44+
- `output` (String) Output of the audio media.
45+
- `output_label` (String) Output label of the audio media.
46+
- `samplerate` (String) Sample rate of the audio media.
47+
- `track` (String) Track of the audio media.
48+
49+
50+
<a id="nestedatt--subtitle_medias"></a>
51+
### Nested Schema for `subtitle_medias`
52+
53+
Optional:
54+
55+
- `bitrate` (Number) Bitrate of the subtitle media.
56+
- `deaf_and_hard_of_hearing` (Boolean) Deaf and hard of hearing of the subtitle media.
57+
- `output` (String) Output of the subtitle media.
58+
- `output_label` (String) Output label of the subtitle media.
59+
- `track` (String) Track of the subtitle media.
60+
61+
62+
<a id="nestedatt--video_medias"></a>
63+
### Nested Schema for `video_medias`
64+
65+
Required:
66+
67+
- `bitrate` (Number) Bitrate of the video media.
68+
- `codec` (String) Codec of the video media.
69+
- `resolution` (Attributes) Resolution of the video media. (see [below for nested schema](#nestedatt--video_medias--resolution))
70+
71+
Optional:
72+
73+
- `coder` (String) Coder of the video media.
74+
- `framerate` (String) Framerate of the video media.
75+
- `label` (String) Label of the video media.
76+
77+
<a id="nestedatt--video_medias--resolution"></a>
78+
### Nested Schema for `video_medias.resolution`
79+
80+
Required:
81+
82+
- `height` (Number) Height of the resolution.
83+
- `width` (Number) Width of the resolution.

0 commit comments

Comments
 (0)