Compare commits
3 commits
main
...
test/notif
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b06e7ffd40 | ||
|
|
ff144042ba | ||
|
|
413dbd6f50 |
9 changed files with 200 additions and 288 deletions
109
.github/actions/acc_test/action.yaml
vendored
109
.github/actions/acc_test/action.yaml
vendored
|
|
@ -65,15 +65,6 @@ inputs:
|
||||||
description: "testfile to run"
|
description: "testfile to run"
|
||||||
default: ''
|
default: ''
|
||||||
|
|
||||||
outputs:
|
|
||||||
result:
|
|
||||||
value: ${{ steps.testrun.outputs.result }}
|
|
||||||
description: "the output of the tests"
|
|
||||||
|
|
||||||
status:
|
|
||||||
value: ${{ steps.status.outputs.status }}
|
|
||||||
description: "the status of the tests"
|
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
steps:
|
steps:
|
||||||
|
|
@ -97,10 +88,6 @@ runs:
|
||||||
with:
|
with:
|
||||||
terraform_wrapper: false
|
terraform_wrapper: false
|
||||||
|
|
||||||
- uses: actions/setup-node@v6
|
|
||||||
with:
|
|
||||||
node-version: '24.x'
|
|
||||||
|
|
||||||
- name: Setup JAVA
|
- name: Setup JAVA
|
||||||
uses: actions/setup-java@v5
|
uses: actions/setup-java@v5
|
||||||
with:
|
with:
|
||||||
|
|
@ -203,11 +190,11 @@ runs:
|
||||||
ls -l stackit/"${{ inputs.service_account_json_file_path }}"
|
ls -l stackit/"${{ inputs.service_account_json_file_path }}"
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
|
|
||||||
- name: Run acceptance tests
|
- name: Run acceptance test file
|
||||||
id: testrun
|
if: ${{ inputs.test_file != '' }}
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
echo "::group::go test"
|
echo "::group::go test file"
|
||||||
set -e
|
set -e
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
|
|
@ -216,22 +203,7 @@ runs:
|
||||||
export TF_LOG
|
export TF_LOG
|
||||||
fi
|
fi
|
||||||
|
|
||||||
testfile="${{ inputs.test_file }}"
|
|
||||||
|
|
||||||
echo "result=no result before run" >> "$GITHUB_OUTPUT"
|
|
||||||
|
|
||||||
echo "Running acceptance tests for the terraform provider"
|
echo "Running acceptance tests for the terraform provider"
|
||||||
|
|
||||||
if [[ -z "$testfile" ]]; then
|
|
||||||
testfile="./..."
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -z "$testfile" ]]; then
|
|
||||||
echo "ERROR: No test file provided"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
set +e
|
|
||||||
cd stackit || exit 1
|
cd stackit || exit 1
|
||||||
TF_ACC=1 \
|
TF_ACC=1 \
|
||||||
TF_ACC_PROJECT_ID=${TF_ACC_PROJECT_ID} \
|
TF_ACC_PROJECT_ID=${TF_ACC_PROJECT_ID} \
|
||||||
|
|
@ -242,21 +214,7 @@ runs:
|
||||||
TF_ACC_KEK_KEY_RING_ID=${TF_ACC_KEK_KEY_RING_ID} \
|
TF_ACC_KEK_KEY_RING_ID=${TF_ACC_KEK_KEY_RING_ID} \
|
||||||
TF_ACC_KEK_KEY_VERSION=${TF_ACC_KEK_KEY_VERSION} \
|
TF_ACC_KEK_KEY_VERSION=${TF_ACC_KEK_KEY_VERSION} \
|
||||||
TF_ACC_KEK_SERVICE_ACCOUNT=${TF_ACC_KEK_SERVICE_ACCOUNT} \
|
TF_ACC_KEK_SERVICE_ACCOUNT=${TF_ACC_KEK_SERVICE_ACCOUNT} \
|
||||||
go test -v ${testfile} -timeout=${{ inputs.test_timeout_string }} | tee -a acc_test_run.log
|
go test -v ${{ inputs.test_file }} -timeout=${{ inputs.test_timeout_string }} | tee -a acc_test_run.log
|
||||||
set -e
|
|
||||||
|
|
||||||
have_fail=$(cat acc_test_run.log | grep FAIL)
|
|
||||||
if [[ -n $have_fail ]]; then
|
|
||||||
echo "::endgroup::"
|
|
||||||
echo "::group::go test result"
|
|
||||||
echo "Test failed, see acc_test_run.log for details"
|
|
||||||
echo "${have_fail}"
|
|
||||||
echo "result=<b>FAIL:</b> <br />${have_fail}" >> "$GITHUB_OUTPUT"
|
|
||||||
echo "::endgroup::"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "result=no FAIL detected" >> "$GITHUB_OUTPUT"
|
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
env:
|
env:
|
||||||
TF_ACC_PROJECT_ID: ${{ inputs.project_id }}
|
TF_ACC_PROJECT_ID: ${{ inputs.project_id }}
|
||||||
|
|
@ -267,16 +225,55 @@ runs:
|
||||||
TF_ACC_KEK_KEY_VERSION: ${{ inputs.tf_acc_kek_key_version }}
|
TF_ACC_KEK_KEY_VERSION: ${{ inputs.tf_acc_kek_key_version }}
|
||||||
TF_ACC_KEK_SERVICE_ACCOUNT: ${{ inputs.tf_acc_kek_service_account }}
|
TF_ACC_KEK_SERVICE_ACCOUNT: ${{ inputs.tf_acc_kek_service_account }}
|
||||||
|
|
||||||
- name: Set status output variable
|
# does not work correctly
|
||||||
if: always()
|
# - name: Run test action
|
||||||
id: status
|
# if: ${{ inputs.test_file == '' }}
|
||||||
|
# env:
|
||||||
|
# TF_ACC: 1
|
||||||
|
# TF_ACC_PROJECT_ID: ${{ inputs.project_id }}
|
||||||
|
# TF_ACC_REGION: ${{ inputs.region }}
|
||||||
|
# TF_ACC_TEST_PROJECT_USER_EMAIL: ${{ inputs.project_user_email }}
|
||||||
|
# TF_ACC_KEK_KEY_ID: ${{ inputs.tf_acc_kek_key_id }}
|
||||||
|
# TF_ACC_KEK_KEY_RING_ID: ${{ inputs.tf_acc_kek_key_ring_id }}
|
||||||
|
# TF_ACC_KEK_KEY_VERSION: ${{ inputs.tf_acc_kek_key_version }}
|
||||||
|
# TF_ACC_KEK_SERVICE_ACCOUNT: ${{ inputs.tf_acc_kek_service_account }}
|
||||||
|
# TF_ACC_SERVICE_ACCOUNT_FILE: ${{ steps.service_account.outputs.safile }}
|
||||||
|
# uses: robherley/go-test-action@v0
|
||||||
|
# with:
|
||||||
|
# testArguments: "./... -timeout ${{ inputs.test_timeout_string }}"
|
||||||
|
# moduleDirectory: "stackit"
|
||||||
|
|
||||||
|
- name: Run all acceptance tests
|
||||||
|
if: ${{ inputs.test_file == '' }}
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
echo "status=${{ steps.testrun.outcome == 'success' && 'SUCCESS' || 'FAILURE' }}" >> "$GITHUB_OUTPUT"
|
echo "::group::go test all"
|
||||||
|
set -e
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
- name: Upload test log artifact
|
if [[ "${{ inputs.tf_debug }}" == "true" ]]; then
|
||||||
if: always()
|
TF_LOG=INFO
|
||||||
uses: actions/upload-artifact@v3
|
export TF_LOG
|
||||||
with:
|
fi
|
||||||
name: acc_test.log
|
|
||||||
path: "stackit/acc_test_run.log"
|
echo "Running acceptance tests for the terraform provider"
|
||||||
|
cd stackit || exit 1
|
||||||
|
TF_ACC=1 \
|
||||||
|
TF_ACC_PROJECT_ID=${TF_ACC_PROJECT_ID} \
|
||||||
|
TF_ACC_REGION=${TF_ACC_REGION} \
|
||||||
|
TF_ACC_TEST_PROJECT_USER_EMAIL=${TF_ACC_TEST_PROJECT_USER_EMAIL} \
|
||||||
|
TF_ACC_SERVICE_ACCOUNT_FILE="${PWD}/${{ inputs.service_account_json_file_path }}" \
|
||||||
|
TF_ACC_KEK_KEY_ID=${TF_ACC_KEK_KEY_ID} \
|
||||||
|
TF_ACC_KEK_KEY_RING_ID=${TF_ACC_KEK_KEY_RING_ID} \
|
||||||
|
TF_ACC_KEK_KEY_VERSION=${TF_ACC_KEK_KEY_VERSION} \
|
||||||
|
TF_ACC_KEK_SERVICE_ACCOUNT=${TF_ACC_KEK_SERVICE_ACCOUNT} \
|
||||||
|
go test -v ./... -timeout=${{ inputs.test_timeout_string }}
|
||||||
|
echo "::endgroup::"
|
||||||
|
env:
|
||||||
|
TF_ACC_PROJECT_ID: ${{ inputs.project_id }}
|
||||||
|
TF_ACC_REGION: ${{ inputs.region }}
|
||||||
|
TF_ACC_TEST_PROJECT_USER_EMAIL: ${{ inputs.project_user_email }}
|
||||||
|
TF_ACC_KEK_KEY_ID: ${{ inputs.tf_acc_kek_key_id }}
|
||||||
|
TF_ACC_KEK_KEY_RING_ID: ${{ inputs.tf_acc_kek_key_ring_id }}
|
||||||
|
TF_ACC_KEK_KEY_VERSION: ${{ inputs.tf_acc_kek_key_version }}
|
||||||
|
TF_ACC_KEK_SERVICE_ACCOUNT: ${{ inputs.tf_acc_kek_service_account }}
|
||||||
|
|
|
||||||
73
.github/actions/clean_up/action.yaml
vendored
73
.github/actions/clean_up/action.yaml
vendored
|
|
@ -41,18 +41,6 @@ outputs:
|
||||||
description: "stackit cli version"
|
description: "stackit cli version"
|
||||||
value: ${{ steps.stackit_version.outputs.version }}
|
value: ${{ steps.stackit_version.outputs.version }}
|
||||||
|
|
||||||
pre_count:
|
|
||||||
description: "number of resources found"
|
|
||||||
value: ${{ steps.retrieve_pre.outputs.count }}
|
|
||||||
|
|
||||||
post_count:
|
|
||||||
description: "number of resources found"
|
|
||||||
value: ${{ steps.retrieve_post.outputs.count }}
|
|
||||||
|
|
||||||
status:
|
|
||||||
description: "status of the test"
|
|
||||||
value: ${{ steps.status.outputs.status }}
|
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
steps:
|
steps:
|
||||||
|
|
@ -127,8 +115,7 @@ runs:
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Retrieve resources before
|
- name: Retrieve resources
|
||||||
id: retrieve_pre
|
|
||||||
run: |
|
run: |
|
||||||
echo "::group::retrieve resources"
|
echo "::group::retrieve resources"
|
||||||
set -e
|
set -e
|
||||||
|
|
@ -138,28 +125,21 @@ runs:
|
||||||
stackit auth activate-service-account --service-account-key-path .svc_acc.json
|
stackit auth activate-service-account --service-account-key-path .svc_acc.json
|
||||||
|
|
||||||
echo "SQL Server Flex resources:"
|
echo "SQL Server Flex resources:"
|
||||||
sql_res=$(stackit --verbosity ${{ inputs.log_level }} --project-id "${{ inputs.project_id }}" beta sqlserverflex instance list --output-format json | jq -r '.[] | select(.name | startswith("${{ inputs.tf_resource_prefix }}"))')
|
stackit --verbosity ${{ inputs.log_level }} --project-id "${{ inputs.project_id }}" beta sqlserverflex instance list --output-format json | jq -r '.[] | select(.name | startswith("${{ inputs.tf_resource_prefix }}"))'
|
||||||
sql_count=$(echo "$sql_res" | jq -r '.id' | wc -l)
|
|
||||||
|
|
||||||
echo "PostgreSQL Flex resources:"
|
echo "PostgreSQL Flex resources:"
|
||||||
pg_res=$(stackit --verbosity ${{ inputs.log_level }} --project-id "${{ inputs.project_id }}" postgresflex instance list --output-format json | jq -r '.[] | select(.name | startswith("${{ inputs.tf_resource_prefix }}"))')
|
stackit --verbosity ${{ inputs.log_level }} --project-id "${{ inputs.project_id }}" postgresflex instance list --output-format json | jq -r '.[] | select(.name | startswith("${{ inputs.tf_resource_prefix }}"))'
|
||||||
pg_count=$(echo "$pg_res" | jq -r '.id' | wc -l)
|
|
||||||
|
|
||||||
echo "Number of resources found: ${sql_count} SQL Server Flex, ${pg_count} PostgreSQL Flex"
|
|
||||||
echo "count=$(( ${pg_count} + ${sql_count} ))" >> $GITHUB_OUTPUT
|
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Delete SQL Server Flex resources
|
- name: Delete SQL Server Flex resources
|
||||||
if: ${{ inputs.list_only != 'true' }}
|
if: ${{ inputs.list_only != 'true' }}
|
||||||
id: del_sql
|
|
||||||
run: |
|
run: |
|
||||||
echo "::group::delete SQL Server Flex resources"
|
echo "::group::delete SQL Server Flex resources"
|
||||||
|
set -e
|
||||||
stackit --verbosity ${{ inputs.log_level }} auth activate-service-account --service-account-key-path .svc_acc.json
|
stackit --verbosity ${{ inputs.log_level }} auth activate-service-account --service-account-key-path .svc_acc.json
|
||||||
for s in $(stackit --verbosity ${{ inputs.log_level }} --project-id ${{ inputs.project_id }} beta sqlserverflex instance list --output-format json | jq -r '.[] | select(.name | startswith("${{ inputs.tf_resource_prefix }}")) | .id');
|
for s in $(stackit --verbosity ${{ inputs.log_level }} --project-id ${{ inputs.project_id }} beta sqlserverflex instance list --output-format json | jq -r '.[] | select(.name | startswith("${{ inputs.tf_resource_prefix }}")) | .id'); do stackit --verbosity ${{ inputs.log_level }} -y --project-id ${{ inputs.project_id }} beta sqlserverflex instance delete $s; done
|
||||||
do
|
|
||||||
stackit --verbosity ${{ inputs.log_level }} -y --project-id ${{ inputs.project_id }} beta sqlserverflex instance delete $s || echo "status=FAILURE" >> ${GITHUB_OUTPUT};
|
|
||||||
done
|
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
|
|
@ -172,14 +152,11 @@ runs:
|
||||||
|
|
||||||
- name: Delete PostgreSQL Flex resources
|
- name: Delete PostgreSQL Flex resources
|
||||||
if: ${{ inputs.list_only != 'true' }}
|
if: ${{ inputs.list_only != 'true' }}
|
||||||
id: del_pg
|
|
||||||
run: |
|
run: |
|
||||||
echo "::group::delete PostgreSQL Flex resources"
|
echo "::group::delete PostgreSQL Flex resources"
|
||||||
|
set -e
|
||||||
stackit auth activate-service-account --service-account-key-path .svc_acc.json
|
stackit auth activate-service-account --service-account-key-path .svc_acc.json
|
||||||
for s in $(stackit --verbosity ${{ inputs.log_level }} --project-id ${{ inputs.project_id }} postgresflex instance list --output-format json | jq -r '.[] | select(.name | startswith("${{ inputs.tf_resource_prefix }}")) | .id');
|
for s in $(stackit --verbosity ${{ inputs.log_level }} --project-id ${{ inputs.project_id }} postgresflex instance list --output-format json | jq -r '.[] | select(.name | startswith("${{ inputs.tf_resource_prefix }}")) | .id'); do stackit --verbosity ${{ inputs.log_level }} -y --project-id ${{ inputs.project_id }} postgresflex instance delete $s; done
|
||||||
do
|
|
||||||
stackit --verbosity ${{ inputs.log_level }} -y --project-id ${{ inputs.project_id }} postgresflex instance delete "$s" --force || echo "status=FAILURE" >> ${GITHUB_OUTPUT};
|
|
||||||
done
|
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
|
|
@ -189,39 +166,3 @@ runs:
|
||||||
set -e
|
set -e
|
||||||
echo "Skip deleting: list only mode"
|
echo "Skip deleting: list only mode"
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Retrieve resources after
|
|
||||||
id: retrieve_post
|
|
||||||
run: |
|
|
||||||
echo "::group::retrieve resources"
|
|
||||||
set -e
|
|
||||||
echo "authenticating api"
|
|
||||||
STACKIT_SERVICE_ACCOUNT_KEY_PATH="${PWD}/.svc_acc.json"
|
|
||||||
export STACKIT_SERVICE_ACCOUNT_KEY_PATH
|
|
||||||
stackit auth activate-service-account --service-account-key-path .svc_acc.json
|
|
||||||
|
|
||||||
echo "SQL Server Flex resources:"
|
|
||||||
sql_res=$(stackit --verbosity ${{ inputs.log_level }} --project-id "${{ inputs.project_id }}" beta sqlserverflex instance list --output-format json | jq -r '.[] | select(.name | startswith("${{ inputs.tf_resource_prefix }}"))')
|
|
||||||
sql_count=$(echo "$sql_res" | jq -r '.id' | wc -l)
|
|
||||||
|
|
||||||
echo "PostgreSQL Flex resources:"
|
|
||||||
pg_res=$(stackit --verbosity ${{ inputs.log_level }} --project-id "${{ inputs.project_id }}" postgresflex instance list --output-format json | jq -r '.[] | select(.name | startswith("${{ inputs.tf_resource_prefix }}"))')
|
|
||||||
pg_count=$(echo "$pg_res" | jq -r '.id' | wc -l)
|
|
||||||
|
|
||||||
echo "Number of resources found: ${sql_count} SQL Server Flex, ${pg_count} PostgreSQL Flex"
|
|
||||||
echo "count=$(( ${pg_count} + ${sql_count} ))" >> $GITHUB_OUTPUT
|
|
||||||
echo "::endgroup::"
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Set status
|
|
||||||
if: always()
|
|
||||||
id: status
|
|
||||||
run: |
|
|
||||||
status="SUCCESS"
|
|
||||||
if [[ "${{ steps.del_pg.outputs.status }}" == "FAILURE" ]]; then
|
|
||||||
status=FAILURE"
|
|
||||||
elif [[ "${{ steps.del_sql.outputs.status }}" == "FAILURE" ]]; then
|
|
||||||
status=FAILURE"
|
|
||||||
fi
|
|
||||||
echo "status=$status" >> $GITHUB_OUTPUT
|
|
||||||
shell: bash
|
|
||||||
|
|
|
||||||
63
.github/actions/notify/action.yaml
vendored
63
.github/actions/notify/action.yaml
vendored
|
|
@ -9,17 +9,11 @@ inputs:
|
||||||
title:
|
title:
|
||||||
description: "The title of the notification."
|
description: "The title of the notification."
|
||||||
required: true
|
required: true
|
||||||
|
default: 'no title provided'
|
||||||
subtitle:
|
|
||||||
description: "The subtitle of the notification."
|
|
||||||
default: 'no subtitle provided'
|
|
||||||
|
|
||||||
image_slug:
|
|
||||||
description: "The slug of the image to be included in the notification."
|
|
||||||
default: 'git'
|
|
||||||
|
|
||||||
event_author:
|
event_author:
|
||||||
description: "The author of the event."
|
description: "The author of the event."
|
||||||
|
required: true
|
||||||
default: 'unknown'
|
default: 'unknown'
|
||||||
|
|
||||||
event_title:
|
event_title:
|
||||||
|
|
@ -28,23 +22,35 @@ inputs:
|
||||||
|
|
||||||
event_body:
|
event_body:
|
||||||
description: "The body of the event."
|
description: "The body of the event."
|
||||||
|
required: true
|
||||||
default: 'no body provided'
|
default: 'no body provided'
|
||||||
|
|
||||||
event_number:
|
event_number:
|
||||||
description: "The number of the event."
|
description: "The number of the event."
|
||||||
|
required: true
|
||||||
default: 'no number provided'
|
default: 'no number provided'
|
||||||
|
|
||||||
event_url:
|
event_url:
|
||||||
description: "The url of the event."
|
description: "The url of the event."
|
||||||
|
required: true
|
||||||
default: 'none'
|
default: 'none'
|
||||||
|
|
||||||
status:
|
|
||||||
description: "The status of the event."
|
|
||||||
default: 'UNKNOWN'
|
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
steps:
|
steps:
|
||||||
|
# - name: event list
|
||||||
|
# shell: bash
|
||||||
|
# run: |
|
||||||
|
# cat <<'EOF'
|
||||||
|
# ${{ toJSON(github) }}
|
||||||
|
# EOF
|
||||||
|
#
|
||||||
|
# - name: print env
|
||||||
|
# shell: bash
|
||||||
|
# run: |
|
||||||
|
# env
|
||||||
|
# exit 1
|
||||||
|
|
||||||
- name: Install prerequisites
|
- name: Install prerequisites
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
|
|
@ -54,27 +60,6 @@ runs:
|
||||||
apt install -y curl jq
|
apt install -y curl jq
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
|
|
||||||
- name: Determine status color
|
|
||||||
id: status
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
case "${{ inputs.status }}" in
|
|
||||||
SUCCESS)
|
|
||||||
STATUS_COLOR="006400/228b22"
|
|
||||||
ADD='{"decoratedText": {"startIcon": {"materialIcon": {"name": "check_circle"}},"text": "<b style=\"color: green;\">SUCCESS</b>"}},'
|
|
||||||
;;
|
|
||||||
FAILURE)
|
|
||||||
STATUS_COLOR="8b0000/dc143c"
|
|
||||||
ADD='{"decoratedText": {"startIcon": {"materialIcon": {"name": "stop_circle"}},"text": "<b style=\"color: red;\">FAILURE</b>"}},'
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
STATUS_COLOR="483d8b/6495ed"
|
|
||||||
ADD=''
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
echo "color=${STATUS_COLOR}" >> "$GITHUB_OUTPUT"
|
|
||||||
echo "status_add=${ADD}" >> "$GITHUB_OUTPUT"
|
|
||||||
|
|
||||||
- name: Notify via Google Chat Webhook
|
- name: Notify via Google Chat Webhook
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
|
|
@ -84,8 +69,7 @@ runs:
|
||||||
|
|
||||||
PAYLOAD=$(jq -n -r \
|
PAYLOAD=$(jq -n -r \
|
||||||
--arg header "${{ inputs.title }}" \
|
--arg header "${{ inputs.title }}" \
|
||||||
--arg subtitle "${{ inputs.subtitle }}" \
|
--arg repo "${{ github.repository || '' }}" \
|
||||||
--arg imgurl "https://cdn.simpleicons.org/${{ inputs.image_slug }}/${{ steps.status.outputs.color }}" \
|
|
||||||
--arg title "${{ inputs.event_title || 'no event title given' }}" \
|
--arg title "${{ inputs.event_title || 'no event title given' }}" \
|
||||||
--arg body "${{ inputs.event_body || 'no event body given' }}" \
|
--arg body "${{ inputs.event_body || 'no event body given' }}" \
|
||||||
--arg author "${{ inputs.event_author || 'no event author given' }}" \
|
--arg author "${{ inputs.event_author || 'no event author given' }}" \
|
||||||
|
|
@ -93,8 +77,8 @@ runs:
|
||||||
'{ "cardsV2": [ { "cardId": "notify-${{ github.run_id }}", "card": {
|
'{ "cardsV2": [ { "cardId": "notify-${{ github.run_id }}", "card": {
|
||||||
"header": {
|
"header": {
|
||||||
"title": "\($header)",
|
"title": "\($header)",
|
||||||
"subtitle": "\($subtitle)",
|
"subtitle": "Repo: \($repo)",
|
||||||
"imageUrl": "\($imgurl)",
|
"imageUrl": "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/png/git.png",
|
||||||
"imageType": "SQUARE"
|
"imageType": "SQUARE"
|
||||||
},
|
},
|
||||||
"sections": [
|
"sections": [
|
||||||
|
|
@ -102,13 +86,12 @@ runs:
|
||||||
"header": "\($title)",
|
"header": "\($title)",
|
||||||
"collapsible": false,
|
"collapsible": false,
|
||||||
"widgets": [
|
"widgets": [
|
||||||
${{ steps.status.outputs.status_add }}
|
|
||||||
{
|
{
|
||||||
"decoratedText": {
|
"decoratedText": {
|
||||||
"startIcon": {
|
"icon": {
|
||||||
"knownIcon": "PERSON"
|
"knownIcon": "PERSON"
|
||||||
},
|
},
|
||||||
"text": "<b>\($author)</b>"
|
"text": "<b>Opened by:</b> \($author)"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
31
.github/workflows/ci_new.yaml
vendored
31
.github/workflows/ci_new.yaml
vendored
|
|
@ -33,18 +33,33 @@ jobs:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- name: Notify Google Chat
|
||||||
|
if: ${{ always() }} # Use always to ensure that the notification is also send on failure of former steps
|
||||||
|
uses: SimonScholz/google-chat-action@main
|
||||||
|
with:
|
||||||
|
webhookUrl: '${{ secrets.GOOGLE_WEBHOOK_URL }}'
|
||||||
|
jobStatus: '${{ job.status }}'
|
||||||
|
title: CI pipeline
|
||||||
|
subtitle: "on: ${{ github.event_name }}"
|
||||||
|
#imageUrl: https://raw.githubusercontent.com/SimonScholz/simonscholz.github.io/gatsby-homepage/src/assets/img/avatar.webp
|
||||||
|
#imageType: SQUARE
|
||||||
|
#imageAltText: Alternative image text
|
||||||
|
#createDefaultSection: false
|
||||||
|
#collapsibleDefaultSection: false
|
||||||
|
#uncollapsibleWidgetsCount: 3
|
||||||
|
#additionalSections: '[{"header": "Additional Section", "collapsible": true, "widgets": [{"decoratedText": {"startIcon": {"knownIcon": "STAR"},"text": "Additional Section"}}] }]'
|
||||||
|
#threadKey: ${{ github.event.number }}
|
||||||
|
|
||||||
- name: Notify
|
- name: Notify
|
||||||
if: always()
|
|
||||||
uses: ./.github/actions/notify
|
uses: ./.github/actions/notify
|
||||||
with:
|
with:
|
||||||
webhook_url: ${{ secrets.GOOGLE_WEBHOOK_URL }}
|
webhook_url: ${{ secrets.GOOGLE_WEBHOOK_URL }}
|
||||||
title: "[START] CI pipeline (#${{ forgejo.run_number }})"
|
title: CI pipeline started
|
||||||
subtitle: "${{ forgejo.event_name }} on ${{ forgejo.ref_name }}"
|
event_title: ${{ github.event.type }}
|
||||||
event_title: "${{ forgejo.event_name }} for ${{ forgejo.repository }}"
|
event_author: ${{ github.event.actor.login }}
|
||||||
event_author: ${{ forgejo.actor }}
|
event_body: 'No event body.'
|
||||||
event_body: "${{ forgejo.event_name }} on ${{ forgejo.ref }} for ${{ forgejo.repository }}"
|
event_number: ${{ github.event.id }}
|
||||||
event_number: ${{ forgejo.run_number }}
|
event_url: "https://tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/actions/runs/${{ github.run_id }}"
|
||||||
event_url: "https://tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/actions/runs/${{ forgejo.run_number }}"
|
|
||||||
|
|
||||||
- name: Check GoReleaser
|
- name: Check GoReleaser
|
||||||
uses: goreleaser/goreleaser-action@v7
|
uses: goreleaser/goreleaser-action@v7
|
||||||
|
|
|
||||||
43
.github/workflows/clean_up.yaml
vendored
43
.github/workflows/clean_up.yaml
vendored
|
|
@ -34,20 +34,27 @@ jobs:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: Notify
|
- name: Notify Google Chat
|
||||||
uses: ./.github/actions/notify
|
if: ${{ always() }} # Use always to ensure that the notification is also send on failure of former steps
|
||||||
|
uses: SimonScholz/google-chat-action@main
|
||||||
with:
|
with:
|
||||||
webhook_url: ${{ secrets.GOOGLE_WEBHOOK_URL }}
|
webhookUrl: '${{ secrets.GOOGLE_WEBHOOK_URL }}'
|
||||||
title: "[START] CLEAN UP pipeline (#${{ forgejo.run_number }})"
|
jobStatus: '${{ job.status }}'
|
||||||
subtitle: "${{ forgejo.repository }}"
|
title: CLEAN-UP pipeline
|
||||||
event_title: ${{ forgejo.event_name }}
|
subtitle: "${{ github.event_name }} with filter prefix \"${{ inputs.res_prefix }}\""
|
||||||
event_author: ${{ forgejo.actor }}
|
|
||||||
event_body: "try to remove all resources with prefix <b>${{ inputs.res_prefix }}</b>"
|
# - name: Notify
|
||||||
event_number: ${{ forgejo.run_number }}
|
# uses: ./.github/actions/notify
|
||||||
event_url: "https://tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/actions/runs/${{ forgejo.run_number }}"
|
# with:
|
||||||
|
# webhook_url: ${{ secrets.GOOGLE_WEBHOOK_URL }}
|
||||||
|
# title: CLEAN-UP pipeline
|
||||||
|
# event_title: ${{ github.event.type }}
|
||||||
|
# event_author: ${{ github.event.actor.login }}
|
||||||
|
# event_body: "Filter: ${{ inputs.res_prefix }}"
|
||||||
|
# event_number: ${{ github.event.id }}
|
||||||
|
# event_url: "https://tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/actions/runs/${{ github.run_id }}"
|
||||||
|
|
||||||
- name: Clean
|
- name: Clean
|
||||||
id: clean
|
|
||||||
uses: ./.github/actions/clean_up
|
uses: ./.github/actions/clean_up
|
||||||
with:
|
with:
|
||||||
project_id: ${{ vars.TF_ACC_PROJECT_ID }}
|
project_id: ${{ vars.TF_ACC_PROJECT_ID }}
|
||||||
|
|
@ -56,17 +63,3 @@ jobs:
|
||||||
service_account_json_content_b64: "${{ secrets.TF_ACC_SERVICE_ACCOUNT_JSON_B64 }}"
|
service_account_json_content_b64: "${{ secrets.TF_ACC_SERVICE_ACCOUNT_JSON_B64 }}"
|
||||||
list_only: ${{ inputs.list_only }}
|
list_only: ${{ inputs.list_only }}
|
||||||
log_level: ${{ inputs.log_level }}
|
log_level: ${{ inputs.log_level }}
|
||||||
|
|
||||||
- name: Notify
|
|
||||||
if: always()
|
|
||||||
uses: ./.github/actions/notify
|
|
||||||
with:
|
|
||||||
webhook_url: ${{ secrets.GOOGLE_WEBHOOK_URL }}
|
|
||||||
title: "[END] CLEAN UP pipeline (#${{ forgejo.run_number }})"
|
|
||||||
subtitle: "${{ forgejo.repository }}"
|
|
||||||
event_title: ${{ forgejo.event_name }}
|
|
||||||
event_author: ${{ forgejo.actor }}
|
|
||||||
event_body: "count before cleaning: ${{ steps.clean.outputs.pre_count }} <br /> count after cleaning: ${{ steps.clean.outputs.post_count }}"
|
|
||||||
event_number: ${{ forgejo.run_number }}
|
|
||||||
event_url: "https://tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/actions/runs/${{ forgejo.run_number }}"
|
|
||||||
status: ${{ steps.clean.outcome == 'success' && 'SUCCESS' || 'FAILURE' }}
|
|
||||||
|
|
|
||||||
28
.github/workflows/publish.yaml
vendored
28
.github/workflows/publish.yaml
vendored
|
|
@ -51,13 +51,12 @@ jobs:
|
||||||
uses: ./.github/actions/notify
|
uses: ./.github/actions/notify
|
||||||
with:
|
with:
|
||||||
webhook_url: ${{ secrets.GOOGLE_WEBHOOK_URL }}
|
webhook_url: ${{ secrets.GOOGLE_WEBHOOK_URL }}
|
||||||
title: "[START] Publish (#${{ forgejo.run_number }})"
|
title: Publish started
|
||||||
subtitle: "${{ forgejo.event_name }} on branch ${{ forgejo.ref }}"
|
event_title: ${{ github.event.type }}
|
||||||
event_title: "run started"
|
event_author: ${{ github.event.actor.login }}
|
||||||
event_author: ${{ forgejo.actor }}
|
event_body: "Trigger: ${{ github.event_name }}"
|
||||||
event_body: ""
|
event_number: ${{ github.event.id }}
|
||||||
event_number: ${{ forgejo.event.id }}
|
event_url: "https://tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/actions/runs/${{ github.run_id }}"
|
||||||
event_url: "https://tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/actions/runs/${{ forgejo.run_number }}"
|
|
||||||
|
|
||||||
- name: Setup Go
|
- name: Setup Go
|
||||||
uses: actions/setup-go@v6
|
uses: actions/setup-go@v6
|
||||||
|
|
@ -146,7 +145,6 @@ jobs:
|
||||||
--outFile nav.md
|
--outFile nav.md
|
||||||
|
|
||||||
- name: Publish provider to S3
|
- name: Publish provider to S3
|
||||||
id: publish_to_s3
|
|
||||||
run: |
|
run: |
|
||||||
set -e
|
set -e
|
||||||
cd release/
|
cd release/
|
||||||
|
|
@ -167,17 +165,3 @@ jobs:
|
||||||
# echo "${{ github.ref_name }}" >docs/_version.txt
|
# echo "${{ github.ref_name }}" >docs/_version.txt
|
||||||
scp -o StrictHostKeyChecking=no -r docs ubuntu@${{ vars.DOCS_SERVER_IP }}:/srv/www/
|
scp -o StrictHostKeyChecking=no -r docs ubuntu@${{ vars.DOCS_SERVER_IP }}:/srv/www/
|
||||||
scp -o StrictHostKeyChecking=no nav.md ubuntu@${{ vars.DOCS_SERVER_IP }}:/srv/www/
|
scp -o StrictHostKeyChecking=no nav.md ubuntu@${{ vars.DOCS_SERVER_IP }}:/srv/www/
|
||||||
|
|
||||||
- name: Notify
|
|
||||||
if: always()
|
|
||||||
uses: ./.github/actions/notify
|
|
||||||
with:
|
|
||||||
webhook_url: ${{ secrets.GOOGLE_WEBHOOK_URL }}
|
|
||||||
title: "[END] Publish (#${{ forgejo.run_number }})"
|
|
||||||
subtitle: "${{ forgejo.event_name }} on branch ${{ forgejo.ref }}"
|
|
||||||
event_title: "released: ${{ steps.get_version.outputs.version }}"
|
|
||||||
event_author: ${{ forgejo.actor }}
|
|
||||||
event_body: ""
|
|
||||||
event_number: ${{ forgejo.event.id }}
|
|
||||||
event_url: "https://tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/actions/runs/${{ forgejo.run_number }}"
|
|
||||||
status: "${{ steps.publish_to_s3.outcome == 'success' && 'SUCCESS' || 'FAILURE' }}"
|
|
||||||
|
|
|
||||||
89
.github/workflows/tf-acc-test.yaml
vendored
89
.github/workflows/tf-acc-test.yaml
vendored
|
|
@ -16,23 +16,12 @@ on:
|
||||||
type: boolean
|
type: boolean
|
||||||
default: false
|
default: false
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
test_timeout_string:
|
test_timeout_string:
|
||||||
description: "string that determines the timeout (default: '120m')"
|
description: "string that determines the timeout (default: 45m)"
|
||||||
type: string
|
type: string
|
||||||
default: '120m'
|
default: '90m'
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
test_file:
|
|
||||||
description: "string that determines the test file to run (default all tests)"
|
|
||||||
type: choice
|
|
||||||
options:
|
|
||||||
- tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/wait/postgresflexalpha
|
|
||||||
- tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/postgresflexalpha
|
|
||||||
- tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/wait/sqlserverflexbeta
|
|
||||||
- tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/sqlserverflexbeta
|
|
||||||
default: ''
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
acc_test:
|
acc_test:
|
||||||
name: Acceptance Tests
|
name: Acceptance Tests
|
||||||
|
|
@ -41,31 +30,27 @@ jobs:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: set start time
|
- name: Notify Google Chat
|
||||||
id: start_time
|
if: ${{ always() }} # Use always to ensure that the notification is also send on failure of former steps
|
||||||
continue-on-error: true
|
uses: SimonScholz/google-chat-action@main
|
||||||
run: |
|
with:
|
||||||
time=$(date --rfc-3339=ns)
|
webhookUrl: '${{ secrets.GOOGLE_WEBHOOK_URL }}'
|
||||||
echo "start_time=$time" >> ${GITHUB_OUTPUT}
|
title: Acceptance Tests started
|
||||||
start=$(date +%s%N)
|
subtitle: "${{ github.event_name }}"
|
||||||
echo "start=$start" >> ${GITHUB_OUTPUT}
|
|
||||||
|
|
||||||
- name: Notify
|
- name: Notify
|
||||||
uses: ./.github/actions/notify
|
uses: ./.github/actions/notify
|
||||||
with:
|
with:
|
||||||
webhook_url: ${{ secrets.GOOGLE_WEBHOOK_URL }}
|
webhook_url: ${{ secrets.GOOGLE_WEBHOOK_URL }}
|
||||||
title: "[START] Terraform Acceptance Tests (#${{ forgejo.run_number }})"
|
title: Terraform Acceptance Tests started
|
||||||
subtitle: "${{ forgejo.event_name }} on branch ${{ forgejo.ref }}"
|
event_title: ${{ github.event.type }}
|
||||||
event_title: "started: ${{ steps.start_time.outputs.start_time }}"
|
event_author: ${{ github.event.actor.login }}
|
||||||
event_author: ${{ forgejo.actor }}
|
event_body: 'No event body.'
|
||||||
event_body: ${{ inputs.test_file }}
|
event_number: ${{ github.event.id }}
|
||||||
event_number: ${{ forgejo.run_number }}
|
event_url: "https://tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/actions/runs/${{ github.run_id }}"
|
||||||
event_url: "https://tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/actions/runs/${{ forgejo.run_number }}"
|
|
||||||
|
|
||||||
- name: Run Test (workflow dispatch)
|
- name: Run Test (workflow dispatch)
|
||||||
if: ${{ forgejo.event_name == 'workflow_dispatch' }}
|
if: ${{ github.event_name == 'workflow_dispatch' }}
|
||||||
id: manual_run
|
|
||||||
continue-on-error: true
|
|
||||||
uses: ./.github/actions/acc_test
|
uses: ./.github/actions/acc_test
|
||||||
with:
|
with:
|
||||||
go-version: ${{ env.GO_VERSION }}
|
go-version: ${{ env.GO_VERSION }}
|
||||||
|
|
@ -79,12 +64,9 @@ jobs:
|
||||||
tf_acc_kek_service_account: ${{ vars.TF_ACC_KEK_SERVICE_ACCOUNT }}
|
tf_acc_kek_service_account: ${{ vars.TF_ACC_KEK_SERVICE_ACCOUNT }}
|
||||||
tf_debug: ${{ inputs.enable_debug }}
|
tf_debug: ${{ inputs.enable_debug }}
|
||||||
test_timeout_string: ${{ inputs.test_timeout_string }}
|
test_timeout_string: ${{ inputs.test_timeout_string }}
|
||||||
test_file: ${{ inputs.test_file }}
|
|
||||||
|
|
||||||
- name: Run Test (automatic)
|
- name: Run Test (automatic)
|
||||||
if: ${{ forgejo.event_name != 'workflow_dispatch' }}
|
if: ${{ github.event_name != 'workflow_dispatch' }}
|
||||||
id: automatic_run
|
|
||||||
continue-on-error: true
|
|
||||||
uses: ./.github/actions/acc_test
|
uses: ./.github/actions/acc_test
|
||||||
with:
|
with:
|
||||||
go-version: ${{ env.GO_VERSION }}
|
go-version: ${{ env.GO_VERSION }}
|
||||||
|
|
@ -97,31 +79,22 @@ jobs:
|
||||||
tf_acc_kek_key_version: ${{ vars.TF_ACC_KEK_KEY_VERSION }}
|
tf_acc_kek_key_version: ${{ vars.TF_ACC_KEK_KEY_VERSION }}
|
||||||
tf_acc_kek_service_account: ${{ vars.TF_ACC_KEK_SERVICE_ACCOUNT }}
|
tf_acc_kek_service_account: ${{ vars.TF_ACC_KEK_SERVICE_ACCOUNT }}
|
||||||
|
|
||||||
- name: set end time
|
- name: Notify Google Chat
|
||||||
id: end_time
|
if: ${{ always() }} # Use always to ensure that the notification is also send on failure of former steps
|
||||||
continue-on-error: true
|
uses: SimonScholz/google-chat-action@main
|
||||||
run: |
|
with:
|
||||||
set -e
|
webhookUrl: '${{ secrets.GOOGLE_WEBHOOK_URL }}'
|
||||||
echo "auto status: ${{ steps.automatic_run.outputs.status }}"
|
jobStatus: '${{ job.status }}'
|
||||||
echo "manual status: ${{ steps.manual_run.outputs.status }}"
|
title: Acceptance Tests started
|
||||||
echo "status: ${{ forgejo.event_name == 'workflow_dispatch' && steps.manual_run.outputs.status || steps.automatic_run.outputs.status }}"
|
subtitle: "${{ github.event_name }} finished"
|
||||||
echo "end_time=$(date --rfc-3339=ns)" >> ${GITHUB_OUTPUT}
|
|
||||||
end=$(date +%s%N)
|
|
||||||
echo "end=${end}" >> ${GITHUB_OUTPUT}
|
|
||||||
start=${{ steps.start_time.outputs.start }}
|
|
||||||
diff=$((end-start))
|
|
||||||
duration=$(printf "%s.%s" "${diff:0: -9}" "${diff: -9:3}")
|
|
||||||
echo "duration=${duration}" >> ${GITHUB_OUTPUT}
|
|
||||||
|
|
||||||
- name: Notify
|
- name: Notify
|
||||||
uses: ./.github/actions/notify
|
uses: ./.github/actions/notify
|
||||||
with:
|
with:
|
||||||
webhook_url: ${{ secrets.GOOGLE_WEBHOOK_URL }}
|
webhook_url: ${{ secrets.GOOGLE_WEBHOOK_URL }}
|
||||||
title: "[END] Terraform Acceptance Tests (#${{ forgejo.run_number }})"
|
title: Terraform Acceptance Tests finished
|
||||||
subtitle: "${{ forgejo.event_name }} on branch ${{ forgejo.ref }} with status: ${{ forgejo.event_name == 'workflow_dispatch' && steps.manual_run.outputs.status || steps.automatic_run.outputs.status }}"
|
event_title: ${{ github.event.type }}
|
||||||
event_title: "run ended: ${{ steps.end_time.outputs.end_time }}, duration: ${{ steps.end_time.outputs.duration }} seconds"
|
event_author: ${{ github.event.actor.login }}
|
||||||
event_author: ${{ forgejo.actor }}
|
event_body: 'No event body.'
|
||||||
event_body: "${{ forgejo.event_name == 'workflow_dispatch' && steps.manual_run.outputs.result || steps.automatic_run.outputs.result }}"
|
event_number: ${{ github.event.id }}
|
||||||
event_number: ${{ forgejo.event.id }}
|
event_url: "https://tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/actions/runs/${{ github.run_id }}"
|
||||||
event_url: "https://tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/actions/runs/${{ forgejo.run_number }}"
|
|
||||||
status: "${{ forgejo.event_name == 'workflow_dispatch' && steps.manual_run.outputs.status || steps.automatic_run.outputs.status }}"
|
|
||||||
|
|
|
||||||
|
|
@ -157,6 +157,9 @@ func TestAccInstance(t *testing.T) {
|
||||||
updVersion := updNetACL
|
updVersion := updNetACL
|
||||||
updVersion.Version = "17"
|
updVersion.Version = "17"
|
||||||
|
|
||||||
|
updRetention := updVersion
|
||||||
|
updRetention.RetentionDays = 40
|
||||||
|
|
||||||
testItemID := testutils.ResStr(pfx, "instance", exData.TfName)
|
testItemID := testutils.ResStr(pfx, "instance", exData.TfName)
|
||||||
compareValuesSame := statecheck.CompareValue(compare.ValuesSame())
|
compareValuesSame := statecheck.CompareValue(compare.ValuesSame())
|
||||||
resource.ParallelTest(
|
resource.ParallelTest(
|
||||||
|
|
@ -337,6 +340,23 @@ func TestAccInstance(t *testing.T) {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
// Update retention_days
|
||||||
|
{
|
||||||
|
PreConfig: func() {
|
||||||
|
t.Logf(" ... %s - %s", t.Name(), "update version")
|
||||||
|
},
|
||||||
|
Config: testutils.StringFromTemplateMust(
|
||||||
|
"testdata/instance_template.gompl",
|
||||||
|
updVersion,
|
||||||
|
),
|
||||||
|
Check: resource.ComposeTestCheckFunc(
|
||||||
|
resource.TestCheckResourceAttr(
|
||||||
|
testItemID,
|
||||||
|
"retention_days",
|
||||||
|
strconv.Itoa(int(updVersion.RetentionDays)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
},
|
||||||
// Import test
|
// Import test
|
||||||
// test instance imports
|
// test instance imports
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -142,6 +142,9 @@ func TestAccInstance(t *testing.T) {
|
||||||
updSizeData := exData
|
updSizeData := exData
|
||||||
updSizeData.Size = 25
|
updSizeData.Size = 25
|
||||||
|
|
||||||
|
updRetentionDays := updSizeData
|
||||||
|
updRetentionDays.RetentionDays = 30
|
||||||
|
|
||||||
testInstanceID := testutils.ResStr(pfx, "instance", exData.TfName)
|
testInstanceID := testutils.ResStr(pfx, "instance", exData.TfName)
|
||||||
|
|
||||||
compareValuesSame := statecheck.CompareValue(compare.ValuesSame())
|
compareValuesSame := statecheck.CompareValue(compare.ValuesSame())
|
||||||
|
|
@ -182,7 +185,7 @@ func TestAccInstance(t *testing.T) {
|
||||||
PreConfig: func() {
|
PreConfig: func() {
|
||||||
t.Logf("testing: %s - %s", t.Name(), "update name and verify")
|
t.Logf("testing: %s - %s", t.Name(), "update name and verify")
|
||||||
},
|
},
|
||||||
ExpectNonEmptyPlan: false,
|
ExpectNonEmptyPlan: true,
|
||||||
Config: testutils.StringFromTemplateMust(
|
Config: testutils.StringFromTemplateMust(
|
||||||
"testdata/instance_template.gompl",
|
"testdata/instance_template.gompl",
|
||||||
updNameData,
|
updNameData,
|
||||||
|
|
@ -196,23 +199,12 @@ func TestAccInstance(t *testing.T) {
|
||||||
defaultNoEncInstanceTestChecks(testInstanceID, updNameData),
|
defaultNoEncInstanceTestChecks(testInstanceID, updNameData),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
// Expect empty plan after update
|
|
||||||
{
|
|
||||||
PreConfig: func() {
|
|
||||||
t.Logf("testing: %s - %s", t.Name(), "expect empty plan")
|
|
||||||
},
|
|
||||||
ExpectNonEmptyPlan: false,
|
|
||||||
Config: testutils.StringFromTemplateMust(
|
|
||||||
"testdata/instance_template.gompl",
|
|
||||||
updNameData,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
// Update size and verify
|
// Update size and verify
|
||||||
{
|
{
|
||||||
PreConfig: func() {
|
PreConfig: func() {
|
||||||
t.Logf("testing: %s - %s", t.Name(), "update storage.size and verify")
|
t.Logf("testing: %s - %s", t.Name(), "update storage.size and verify")
|
||||||
},
|
},
|
||||||
ExpectNonEmptyPlan: false,
|
ExpectNonEmptyPlan: true,
|
||||||
Config: testutils.StringFromTemplateMust(
|
Config: testutils.StringFromTemplateMust(
|
||||||
"testdata/instance_template.gompl",
|
"testdata/instance_template.gompl",
|
||||||
updSizeData,
|
updSizeData,
|
||||||
|
|
@ -221,6 +213,20 @@ func TestAccInstance(t *testing.T) {
|
||||||
defaultNoEncInstanceTestChecks(testInstanceID, updSizeData),
|
defaultNoEncInstanceTestChecks(testInstanceID, updSizeData),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
// Update retention_days
|
||||||
|
{
|
||||||
|
PreConfig: func() {
|
||||||
|
t.Logf("testing: %s - %s", t.Name(), "update storage.retention_days and verify")
|
||||||
|
},
|
||||||
|
ExpectNonEmptyPlan: true,
|
||||||
|
Config: testutils.StringFromTemplateMust(
|
||||||
|
"testdata/instance_template.gompl",
|
||||||
|
updRetentionDays,
|
||||||
|
),
|
||||||
|
Check: resource.ComposeTestCheckFunc(
|
||||||
|
defaultNoEncInstanceTestChecks(testInstanceID, updRetentionDays),
|
||||||
|
),
|
||||||
|
},
|
||||||
// Import test
|
// Import test
|
||||||
// test instance imports
|
// test instance imports
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue