diff --git a/.github/workflows/examples-test.yml b/.github/workflows/terraform_examples.yml similarity index 87% rename from .github/workflows/examples-test.yml rename to .github/workflows/terraform_examples.yml index 177a28d0e..d985fa894 100644 --- a/.github/workflows/examples-test.yml +++ b/.github/workflows/terraform_examples.yml @@ -1,4 +1,4 @@ -name: Examples tests +name: Examples terraform tests on: pull_request: @@ -14,7 +14,7 @@ on: workflow_dispatch: jobs: - Examples_tests: + Examples_terraform_tests: environment: test-eu-west-2 runs-on: [self-hosted, linux, eu-west-2] steps: @@ -22,7 +22,7 @@ jobs: with: repository: ${{ github.event.pull_request.head.repo.full_name }} ref: ${{ github.event.pull_request.head.ref }} - - uses: outscale-dev/frieza-github-actions/frieza-clean@master + - uses: outscale/frieza-github-actions/frieza-clean@master with: access_key: ${{ secrets.OSC_ACCESS_KEY }} secret_key: ${{ secrets.OSC_SECRET_KEY }} @@ -35,7 +35,7 @@ jobs: with: terraform_wrapper: false - name: Run Examples - run: make test-examples + run: make terraform-examples env: TF_VAR_access_key_id: ${{ secrets.OSC_ACCESS_KEY }} TF_VAR_secret_key_id: ${{ secrets.OSC_SECRET_KEY }} diff --git a/.github/workflows/tofu_examples.yml b/.github/workflows/tofu_examples.yml new file mode 100644 index 000000000..3b495adc3 --- /dev/null +++ b/.github/workflows/tofu_examples.yml @@ -0,0 +1,43 @@ +name: Examples tofu tests + +on: + pull_request: + branches: + - master + paths: + - 'examples/**.tfvars' + - 'examples/**.tf' + - 'scripts/test-examples.sh' + - 'GNUmakefile' + schedule: + - cron: '30 22 * * *' + workflow_dispatch: + +jobs: + Examples_tofu_tests: + environment: test-eu-west-2 + runs-on: [self-hosted, linux, eu-west-2] + steps: + - uses: actions/checkout@v4 + with: + repository: ${{ github.event.pull_request.head.repo.full_name }} + ref: ${{ github.event.pull_request.head.ref }} + - uses: outscale/frieza-github-actions/frieza-clean@master + with: + access_key: ${{ secrets.OSC_ACCESS_KEY }} + secret_key: ${{ secrets.OSC_SECRET_KEY }} + region: ${{ secrets.OSC_REGION }} + - uses: actions/setup-go@v5 + with: + go-version: 'stable' + - name: Setup OpenTofu + uses: opentofu/setup-opentofu@v1 + with: + tofu_wrapper: false + - name: Run Examples + run: make tofu-examples + env: + TF_VAR_access_key_id: ${{ secrets.OSC_ACCESS_KEY }} + TF_VAR_secret_key_id: ${{ secrets.OSC_SECRET_KEY }} + TF_VAR_region: ${{ secrets.OSC_REGION }} + TF_VAR_image_id: ${{ secrets.OSC_OMI_EXEMPLE }} \ No newline at end of file diff --git a/GNUmakefile b/GNUmakefile index a1bf00775..968a5e7bd 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -66,9 +66,13 @@ test-locally: "$(CURDIR)/scripts/local-test.sh" TestAccOthers_Volume_io1Type "$(CURDIR)/scripts/local-test.sh" TestAccVM_withFlexibleGpuLink_basic -.PHONY: test-examples -test-examples: - @sh -c "'$(CURDIR)/scripts/test-examples.sh'" +.PHONY: terraform-examples +terraform-examples: + @sh -c "'$(CURDIR)/scripts/terraform-examples.sh'" + +.PHONY: tofu-examples +tofu-examples: + @sh -c "'$(CURDIR)/scripts/tofu-examples.sh'" .PHONY: test-integration test-integration: diff --git a/examples/keypair/outscale.tf b/examples/keypair/outscale.tf index e374d2a92..b15868aab 100644 --- a/examples/keypair/outscale.tf +++ b/examples/keypair/outscale.tf @@ -2,7 +2,7 @@ terraform { required_providers { outscale = { source = "outscale/outscale" - version = ">= 0.2.0" + version = ">= 0.11.0" } } } diff --git a/examples/net/outscale.tf b/examples/net/outscale.tf index e374d2a92..b15868aab 100644 --- a/examples/net/outscale.tf +++ b/examples/net/outscale.tf @@ -2,7 +2,7 @@ terraform { required_providers { outscale = { source = "outscale/outscale" - version = ">= 0.2.0" + version = ">= 0.11.0" } } } diff --git a/examples/net_vm/outscale.tf b/examples/net_vm/outscale.tf index e374d2a92..b15868aab 100644 --- a/examples/net_vm/outscale.tf +++ b/examples/net_vm/outscale.tf @@ -2,7 +2,7 @@ terraform { required_providers { outscale = { source = "outscale/outscale" - version = ">= 0.2.0" + version = ">= 0.11.0" } } } diff --git a/examples/public_load_balancer/outscale.tf b/examples/public_load_balancer/outscale.tf index e374d2a92..b15868aab 100644 --- a/examples/public_load_balancer/outscale.tf +++ b/examples/public_load_balancer/outscale.tf @@ -2,7 +2,7 @@ terraform { required_providers { outscale = { source = "outscale/outscale" - version = ">= 0.2.0" + version = ">= 0.11.0" } } } diff --git a/examples/public_vm/outscale.tf b/examples/public_vm/outscale.tf index e374d2a92..b15868aab 100644 --- a/examples/public_vm/outscale.tf +++ b/examples/public_vm/outscale.tf @@ -2,7 +2,7 @@ terraform { required_providers { outscale = { source = "outscale/outscale" - version = ">= 0.2.0" + version = ">= 0.11.0" } } } diff --git a/examples/security_group/outscale.tf b/examples/security_group/outscale.tf index e374d2a92..b15868aab 100644 --- a/examples/security_group/outscale.tf +++ b/examples/security_group/outscale.tf @@ -2,7 +2,7 @@ terraform { required_providers { outscale = { source = "outscale/outscale" - version = ">= 0.2.0" + version = ">= 0.11.0" } } } diff --git a/examples/volumes/outscale.tf b/examples/volumes/outscale.tf index e374d2a92..b15868aab 100644 --- a/examples/volumes/outscale.tf +++ b/examples/volumes/outscale.tf @@ -2,7 +2,7 @@ terraform { required_providers { outscale = { source = "outscale/outscale" - version = ">= 0.2.0" + version = ">= 0.11.0" } } } diff --git a/examples/yunohost/outscale.tf b/examples/yunohost/outscale.tf index e374d2a92..b15868aab 100644 --- a/examples/yunohost/outscale.tf +++ b/examples/yunohost/outscale.tf @@ -2,7 +2,7 @@ terraform { required_providers { outscale = { source = "outscale/outscale" - version = ">= 0.2.0" + version = ">= 0.11.0" } } } diff --git a/scripts/test-examples.sh b/scripts/terraform-examples.sh similarity index 100% rename from scripts/test-examples.sh rename to scripts/terraform-examples.sh diff --git a/scripts/tofu-examples.sh b/scripts/tofu-examples.sh new file mode 100755 index 000000000..d269e1d70 --- /dev/null +++ b/scripts/tofu-examples.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +set -e + +project_dir=$(cd "$(dirname $0)" && pwd) +project_root=$(cd $project_dir/.. && pwd) +EXAMPLES_DIR=$project_root/examples + +go build -o terraform-provider-outscale + +for f in $EXAMPLES_DIR/* +do + if [ -d $f ] + then + cd $f + VERSION_DIR=`grep -o '[[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*' outscale.tf` + INSTALL_DIR=$f/terraform.d/providers/registry.opentofu.org/outscale/outscale/$VERSION_DIR/linux_amd64/ + echo $INSTALL_DIR + mkdir -p $INSTALL_DIR + cp ../../terraform-provider-outscale $INSTALL_DIR + tofu init + tofu apply -auto-approve + tofu destroy -auto-approve + cd - + fi +done + +exit 0