Description
Description
Create CI/ CD with e2e test pipeline and environments for the TF provider
E2E will ensure consistent application quality across environments: E2E testing verifies the provider resources and data sources ensuring that the provider works as intended across a wide range of tenants and environments.
Some of the benefits of end-to-end testing are:
- It improves the quality and reliability of the software by verifying the functionality and performance of the entire application workflow.
- It simulates the real user scenarios and ensures that the software meets the user expectations and requirements.
- It detects bugs and issues that may arise when different components or systems interact with each other.
- It reduces the time and cost of testing by eliminating the need for extensive manual testing and debugging.
Note: this requires a PP tenant with Azure.
Resource
GitHub action to deploy to 2 or 3 environments
Potential Terraform YAML
# This is a sample GitHub action for end-to-end testing of Terraform code
# It uses the hashicorp/setup-terraform action to install and configure Terraform
# It also uses the azure/login action to authenticate to Azure
# It runs Terraform init, plan, and apply commands to deploy the Terraform configuration
# It then runs some tests to verify the deployment using the azure/cli action
# Finally, it runs Terraform destroy to clean up the resources
name: E2E Terraform Test
on: [push]
jobs:
e2e-test:
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/checkout@v2
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1
with:
terraform_version: 1.0.11
- name: Login to Azure
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Terraform Init
run: terraform init
- name: Terraform Plan
run: terraform plan -out=tfplan
- name: Terraform Apply
run: terraform apply -auto-approve tfplan
- name: Run Tests
uses: azure/cli@v1
with:
inlineScript: |
# Write your test commands here
# For example, you can use az resource show to check the properties of a resource
# Or you can use curl or wget to test the connectivity of a web app
# You can also use Terratest or other testing frameworks to run more complex tests
- name: Terraform Destroy
run: terraform destroy -auto-approve
if: always()
Posible tasks
- Get environment We need an environment with azure to execute this pipeline.
- Create creedentials.
- Create Environments Dev, Test and STG/Prod.
- Decide and document Branch strategy, Branch to deploy to Dev, branch for test and main or prod branch.
- Define and implement versioning for the provider.
Definition of Done
- GitHub Action Implementation
- E2E added to tue quickstarts.
- Example in the /examples folder
- Schema Documentation in code yaml
Contributions
Do you plan to raise a PR to address this issue? YES / NO?
See the contributing guide for more information about what's expected for contributions.
Samples
How To Deploy Multiple Environments in Your Terraform Project Without Duplicating Code
https://www.digitalocean.com/community/tutorials/how-to-deploy-multiple-environments-with-workspaces-in-your-terraform-project