Skip to content

Commit

Permalink
Initial module with template and source
Browse files Browse the repository at this point in the history
  • Loading branch information
bczoma committed Feb 22, 2024
1 parent 2a9b1a7 commit b930a31
Show file tree
Hide file tree
Showing 23 changed files with 127,192 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/module-test-pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Provider Test Pipeline

on: push

jobs:
test:
name: Run Provider setup and tests
runs-on: ubuntu-latest
steps:
# - name: Set up Go
# uses: actions/setup-go@v3
# with:
# go-version: "1.21"

- name: Check out code
uses: actions/checkout@v4

- name: Set up Terraform latest
uses: hashicorp/setup-terraform@v2

- name: Setup test broker
run: |
mkdir -p $HOME/solace; chmod 777 $HOME/solace
docker run -d -p 8080:8080 -p 55555:55555 --shm-size=1g --env username_admin_globalaccesslevel=admin --env username_admin_password=admin --env system_scaling_maxkafkabridgecount="10" --name=solace \
--env system_scaling_maxconnectioncount="1000" --mount type=bind,source=$HOME/solace,destination=/var/lib/solace,ro=false solace/solace-pubsub-standard:latest
while ! curl -s localhost:8080 | grep aurelia ; do sleep 1 ; done
- name: Test module from template on test broker
run: |
ci/scripts/test-module.sh ci/template-test
- name: Test module root on test broker
run: |
ci/scripts/test-module.sh ci/module-test
- name: Test examples
run: |
for dir in examples/*; do (ci/scripts/test-module.sh "$dir"); done
# ci/scripts/test-module.sh examples/non-exclusive-queue
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.1.0-rc.1
25 changes: 25 additions & 0 deletions ci/module-test/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 46 additions & 0 deletions ci/module-test/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
provider "solacebroker" {
username = "admin"
password = "admin"
url = "http://localhost:8080"
}

module "testrdp" {
source = "../.."

msg_vpn_name = "default"
queue_name = "my_queue"
url = "http://example.com/$${msgId()}"
rest_delivery_point_name = "my_rdp"
rest_consumer_name = "my_consumer"
request_header = [
{
header_name = "header1"
header_value = "$${uuid()}"
},
{
header_name = "header2"
header_value = "value2"
}
]
oauth_jwt_claim = [
{
oauth_jwt_claim_name = "scope"
oauth_jwt_claim_value = "\"https://www.googleapis.com/auth/pubsub\""
},
{
oauth_jwt_claim_name = "aud"
oauth_jwt_claim_value = "\"https://www.googleapis.com/oauth2/v4/token\""
},
{
oauth_jwt_claim_name = "iss"
oauth_jwt_claim_value = "\"111400995554822290197\""
},
{
oauth_jwt_claim_name = "sub"
oauth_jwt_claim_value = "\"111400995554822290197\""
}
]


}

10 changes: 10 additions & 0 deletions ci/module-test/providers.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Terraform configuration

terraform {
required_providers {
solacebroker = {
source = "registry.terraform.io/solaceproducts/solacebroker"
}
}
required_version = "~> 1.2"
}
17 changes: 17 additions & 0 deletions ci/scripts/test-module.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
# Basic terraform test on a config.
# Params: $1 is the directory name, $2 (optional), the module registry URL, $3 (optional), the module version
set -e
pushd "$1"
if [ -n "$2" ] ; then sed -i "s@source =.*@source = \"$2\"@g" main.tf; fi
if [ -n "$3" ] ; then sed -i "s@# version =.*@version = \"$3\"@g" main.tf; fi
cat main.tf
terraform init
terraform validate
# Create
terraform plan
terraform apply -auto-approve
terraform plan | grep "No changes"
sleep 1
terraform destroy -auto-approve
popd
Loading

0 comments on commit b930a31

Please sign in to comment.