Skip to content

Commit

Permalink
Updated Beta release 0.9.3 (#71)
Browse files Browse the repository at this point in the history
* Code Generator optimization and enhancements including improved resource naming in generated configuration
* Support provider configuration with values that come from other resources
* Bug fixes
  • Loading branch information
bczoma authored Jun 7, 2024
1 parent 12beb44 commit 03ff723
Show file tree
Hide file tree
Showing 278 changed files with 3,917 additions and 3,128 deletions.
33 changes: 21 additions & 12 deletions .github/workflows/cli-test-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: "1.21"
go-version: "1.22"

- name: Check out code
uses: actions/checkout@v4
Expand Down Expand Up @@ -78,10 +78,14 @@ jobs:
fi
exit 1
- name: Generate sample Terraform for message vpn client
- name: Failure to Generate sample Terraform due to invalid provider specific identifiers2
run: |
SOLACEBROKER_REGISTRY_OVERRIDE=registry.terraform.io/solaceproducts/solacebroker SOLACEBROKER_USERNAME=admin SOLACEBROKER_PASSWORD=admin terraform-provider-solacebroker generate --url=http://localhost:8080 solacebroker_msg_vpn_rest_delivery_point.my-rdp default messageVpn.tf
cat messageVpn.tf
SOLACEBROKER_REGISTRY_OVERRIDE=registry.terraform.io/solaceproducts/solacebroker SOLACEBROKER_USERNAME=admin SOLACEBROKER_PASSWORD=admin terraform-provider-solacebroker generate --url=http://localhost:8080 solacebroker_msg_vpn_rest_delivery_point.my-rdp default messageVpn.tf || error_code=$?
if [ $error_code -eq 1 ]; then
echo "\nExpected failure accurate"
exit 0
fi
exit 1
- name: Generate sample Terraform for message vpn
run: |
Expand All @@ -91,13 +95,11 @@ jobs:
- name: Test generated terraform on broker
run: |
# Create
sed -i '/# username = "admin"/c\username = "admin"' messageVpn.tf
sed -i '/# password = "admin"/c\password = "admin"' messageVpn.tf
terraform plan
terraform apply -auto-approve
TF_VAR_broker_url=http://localhost:8080 TF_VAR_broker_username=admin TF_VAR_broker_password=admin terraform plan
TF_VAR_broker_url=http://localhost:8080 TF_VAR_broker_username=admin TF_VAR_broker_password=admin terraform apply -auto-approve
sleep 1
- name: Create custom messageVPN with 21 messageVpn queues (Paging Test)
- name: Create custom messageVPN with 22 messageVpn queues (Paging Test)
run: |
pushd ci/broker_vpn_q3
# Create
Expand All @@ -106,11 +108,16 @@ jobs:
sleep 1
popd
- name: Confirm all 21 queues are present with paging (Paging Test)
- name: Confirm all 22 queues are present with paging (Paging Test)
run: |
SOLACEBROKER_REGISTRY_OVERRIDE=registry.terraform.io/solaceproducts/solacebroker SOLACEBROKER_USERNAME=admin SOLACEBROKER_PASSWORD=admin terraform-provider-solacebroker generate --url=http://localhost:8080 solacebroker_msg_vpn.qn another messageVpn.tf
cat messageVpn.tf
grep -o 'solacebroker_msg_vpn_queue" ' messageVpn.tf | wc -l | grep 21
grep -o 'solacebroker_msg_vpn_queue" ' messageVpn.tf | wc -l | grep 22
- name: Test escape characters in resources
run: |
SOLACEBROKER_REGISTRY_OVERRIDE=registry.terraform.io/solaceproducts/solacebroker SOLACEBROKER_USERNAME=admin SOLACEBROKER_PASSWORD=admin terraform-provider-solacebroker generate --url=http://localhost:8080 solacebroker_msg_vpn_queue_subscription.test another/aperfectly%2F%24%2Fvalid%2F%24topic%2F%24%24/foo%2Fbarr messageVpn.tf
cat messageVpn.tf
- name: Create custom messageVPN with large config
run: |
Expand All @@ -125,6 +132,8 @@ jobs:
run: |
SOLACEBROKER_REGISTRY_OVERRIDE=registry.terraform.io/solaceproducts/solacebroker SOLACEBROKER_USERNAME=admin SOLACEBROKER_PASSWORD=admin terraform-provider-solacebroker generate --url=http://localhost:8080 solacebroker_msg_vpn.test test messageVpn.tf
cat messageVpn.tf
# also confirm comment is generated when ancillary object is refereced
cat messageVpn.tf | grep depends_on
- name: Generate some resources( only msg_vpn_queue) for custom messageVPN file
run: |
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/core-pipeline-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: "1.21"
go-version: "1.22"

- name: Check out code
uses: actions/checkout@v4
Expand All @@ -28,14 +28,14 @@ jobs:
- name: Checkout generator
uses: actions/checkout@v4
with:
repository: SolaceDev/broker-terraform-provider-generator
repository: SolaceDev/broker-terraform-code-generator
token: ${{ secrets.GH_PAT }} # `GH_PAT` is a secret that contains your PAT
path: broker-terraform-provider-generator
ref: "v0.2.0"
path: broker-terraform-code-generator
ref: "main"

- name: Build and install generator
run: |
pushd broker-terraform-provider-generator
pushd broker-terraform-code-generator
go mod tidy
go install .
ls ~/go/bin
Expand All @@ -48,7 +48,7 @@ jobs:
BASE=`pwd`
pushd internal/broker/generated
rm ./*
SEMP_V2_SWAGGER_CONFIG_EXTENDED_JSON="$BASE/ci/swagger_spec/$SWAGGER_SPEC_NAME" ~/go/bin/broker-terraform-provider-generator all
SEMP_V2_SWAGGER_CONFIG_EXTENDED_JSON="$BASE/ci/swagger_spec/$SWAGGER_SPEC_NAME" ~/go/bin/broker-terraform-code-generator software-provider all
popd
- name: Build provider
Expand Down Expand Up @@ -76,7 +76,7 @@ jobs:
id: check-changed-files
with:
files: |
!broker-terraform-provider-generator
!broker-terraform-code-generator
- name: Run step only when any of the above files change.
if: steps.check-changed-files.outputs.files_changed == 'true'
Expand All @@ -90,7 +90,7 @@ jobs:
committer_name: GitHub Actions
committer_email: [email protected]
message: 'Updating generated source'
add: ". ':!broker-terraform-provider-generator'"
add: ". ':!broker-terraform-code-generator'"
new_branch: GeneratedSourceUpdates-${{ github.ref_name }}

- name: Create pull request
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/core-pipeline-main-branch-only.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: "1.21"
go-version: "1.22"

- name: Check out code
uses: actions/checkout@v4
Expand Down
53 changes: 25 additions & 28 deletions .github/workflows/prep-internal-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: "1.21"
go-version: "1.22"

- name: Checkout the code
uses: actions/checkout@v2
Expand Down Expand Up @@ -85,15 +85,12 @@ jobs:
sed -i "s/productName=.*$/productName=${{ github.event.repository.name }}/g" ci/whitesource/whitesource-agent.config
sed -i "s/projectName=.*$/projectName=${{ github.event.repository.name }}/g" ci/whitesource/whitesource-agent.config
cat ci/whitesource/whitesource-agent.config | grep productVersion
- name: Run Whitesource Action to update licenses
uses: SolaceDev/[email protected]
with:
wssURL: https://saas.whitesourcesoftware.com/agent
apiKey: ${{ secrets.WSS_API_KEY }}
productName: ${{ github.event.repository.name }}
projectName: ${{ github.event.repository.name }}
configFile: 'ci/whitesource/whitesource-agent.config'
curl https://unified-agent.s3.amazonaws.com/wss-unified-agent.jar --output /ci/whitesource/wss-unified-agent.jar
export WS_APIKEY="${{ secrets.WSS_API_KEY }}"
export WS_WSS_URL="https://saas.whitesourcesoftware.com/agent"
export WS_PRODUCTNAME="${{ github.event.repository.name }}"
export WS_PROJECTNAME="${{ github.event.repository.name }}"
java -jar ci/whitesource/wss-unified-agent.jar -c ci/whitesource/whitesource-agent.config -d .
- name: Create the release branch
uses: peterjgrainger/[email protected]
Expand All @@ -110,20 +107,20 @@ jobs:
# with:
# branch: ${{ env.NEXT_DEV_VERSION }}

- name: Create next dev branch
if: env.NEXT_DEV_VERSION != ''
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git checkout -b ${{ env.NEXT_DEV_VERSION }}
VERSION=$(echo "${{ env.NEXT_DEV_VERSION }}" | cut -d'v' -f2)
sed -i "s/version =.*$/version = \"${VERSION}\"/g" version.go
git commit -a -m "Uprev'd version to ${VERSION}"
git push --set-upstream origin ${{ env.NEXT_DEV_VERSION }}
- name: Delete last dev branch
if: env.NEXT_DEV_VERSION != ''
uses: dawidd6/action-delete-branch@v3
with:
github_token: ${{github.token}}
branches: "${{ github.ref_name }}"
# - name: Create next dev branch
# if: env.NEXT_DEV_VERSION != ''
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: |
# git checkout -b ${{ env.NEXT_DEV_VERSION }}
# VERSION=$(echo "${{ env.NEXT_DEV_VERSION }}" | cut -d'v' -f2)
# sed -i "s/version =.*$/version = \"${VERSION}\"/g" version.go
# git commit -a -m "Uprev'd version to ${VERSION}"
# git push --set-upstream origin ${{ env.NEXT_DEV_VERSION }}

# - name: Delete last dev branch
# if: env.NEXT_DEV_VERSION != ''
# uses: dawidd6/action-delete-branch@v3
# with:
# github_token: ${{github.token}}
# branches: "${{ github.ref_name }}"
4 changes: 2 additions & 2 deletions .github/workflows/provider-acceptance-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: "1.21"
go-version: "1.22"

- name: Check out code
uses: actions/checkout@v4
Expand Down
39 changes: 35 additions & 4 deletions .github/workflows/provider-test-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: "1.21"
go-version: "1.22"

- name: Check out code
uses: actions/checkout@v4
Expand Down Expand Up @@ -46,7 +46,6 @@ jobs:
pushd ci/broker_vpn_q
terraform plan
popd
- name: Test provider on test broker
run: |
Expand All @@ -69,10 +68,42 @@ jobs:
rm terraform.tfstate*
terraform import solacebroker_msg_vpn.newone new
popd
# larger config
- name: Test larger config
run: |
pushd ci/bigtest
terraform plan
terraform apply -auto-approve
terraform plan
terraform destroy -auto-approve
popd
- name: Test unknown provider param, proving that the solace provider can tolerate unknown provider params until later when it is defined
run: |
pushd ci/provider_dependency
terraform init # sets up the random provider, which will be used to generate a random password (which will be used but login will fail)
bash -c "terraform apply -auto-approve &> results.out" || echo "Expecting terraform apply to fail"
cat results.out | grep "401 Unauthorized"
popd
# Skipping state upgrade test until using new SEMP schema
# - name: Test state upgrade
# run: |
# pushd ci/state_upgrade
# bash -c "terraform plan &> results.out" || echo "Expecting terraform plan to fail"
# cat results.out | grep "Found deprecated state key 'deprecated_att"
# cp terraform.tfstate terraform.tfstate.bak
# sed -i '/deprecated_att/d' terraform.tfstate # remove deprecated non-null attributes from state
# terraform plan | grep "3 to add"
# terraform apply -auto-approve | grep "Apply complete"
# # TODO: GH actions fails on following commands, need to investigate
# # diff terraform.tfstate terraform.tfstate.bak > diff.out
# # ls -l
# # cat diff.out
# # grep "> \"schema_version\": 0," diff.out | wc -l | grep 3 # verify schema has been upgraded
# # grep "> \"deprecated1\": null," diff.out # verify deprecated has been removed
# # grep "> \"deprecated2\": null," diff.out # verify deprecated has been removed
# # grep "< \"clear_percent\": 20," diff.out # verify string has been converted to number
# # grep "< \"egress_enabled\": true," diff.out # verify string has been converted to bool
# # terraform destroy -auto-approve
# popd
4 changes: 2 additions & 2 deletions .github/workflows/verify-registry-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: "1.21"
go-version: "1.22"

- name: Check out code
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ We recommended that you familiarize yourself with Solace technology and broker m
### Requirements

* [Terraform](https://www.terraform.io/downloads) (>= 1.0)
* [Go](https://go.dev/doc/install) (1.21)
* [Go](https://go.dev/doc/install) (1.22)
* [Make](https://www.gnu.org/software/make/)

### Building
Expand Down
2 changes: 0 additions & 2 deletions ci/bigtest/test.tf
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ resource "solacebroker_broker" "broker" {
tls_standard_domain_certificate_authorities_enabled = false
tls_ticket_lifetime = 1
web_manager_allow_unencrypted_wizards_enabled = true
web_manager_customization = "test"
web_manager_redirect_http_enabled = false
web_manager_redirect_http_override_tls_port = 8080
}
Expand Down Expand Up @@ -440,7 +439,6 @@ resource "solacebroker_msg_vpn_bridge_remote_msg_vpn" "msg_vpn_bridge_remote_msg
msg_vpn_name = solacebroker_msg_vpn.msg_vpn.msg_vpn_name
bridge_name = solacebroker_msg_vpn_bridge.msg_vpn_bridge.bridge_name
bridge_virtual_router = solacebroker_msg_vpn_bridge.msg_vpn_bridge.bridge_virtual_router
remote_msg_vpn_interface = ""
remote_msg_vpn_location = "192.168.1.1:1234"
remote_msg_vpn_name = "default"
client_username = "test"
Expand Down
16 changes: 15 additions & 1 deletion ci/broker_vpn_q3/testconfig3.tf
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ resource "solacebroker_msg_vpn_queue" "qds" {

resource "solacebroker_msg_vpn_queue" "qedddss" {
msg_vpn_name = solacebroker_msg_vpn.another.msg_vpn_name
queue_name = "green"
queue_name = "#green"
ingress_enabled = true
egress_enabled = true
max_msg_size = 54321
Expand Down Expand Up @@ -244,3 +244,17 @@ resource "solacebroker_msg_vpn_queue_subscription" "ok9" {
queue_name = solacebroker_msg_vpn_queue.ok9.queue_name
subscription_topic = "foo/ok9"
}

resource "solacebroker_msg_vpn_queue" "q" {
msg_vpn_name = solacebroker_msg_vpn.another.msg_vpn_name
queue_name = "aperfectly/$/valid/$topic/$$"
# ingress_enabled = true
egress_enabled = true
max_msg_size = 54321
}

resource "solacebroker_msg_vpn_queue_subscription" "foo2" {
msg_vpn_name = solacebroker_msg_vpn_queue.q.msg_vpn_name
queue_name = solacebroker_msg_vpn_queue.q.queue_name
subscription_topic = "foo/barr"
}
2 changes: 1 addition & 1 deletion ci/broker_vpn_test/generatortest.tf
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ resource "solacebroker_msg_vpn_queue" "msg_vpn_queue" {
max_msg_spool_usage = 9999
max_redelivery_count = 9
max_ttl = 9
owner = "test"
owner = "#kafka/tx/test"
partition_count = 1
partition_rebalance_delay = 6
partition_rebalance_max_handoff_time = 4
Expand Down
Loading

0 comments on commit 03ff723

Please sign in to comment.