Skip to content

feat: add CI action to test module #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: "CI TF Test"

on:
push:
branches:
- main
pull_request:
branches:
- main
types: [opened, synchronize, reopened]
workflow_dispatch: # allows manual build

env:
ARM_TENANT_ID: ${{ secrets.REPO_AZURE_DSB_TENANT_ID }}
ARM_SUBSCRIPTION_ID: ${{ secrets.REPO_AZURE_SUBSCRIPTION_ID }}
ARM_CLIENT_ID: ${{ secrets.REPO_AZURE_TERRAFORM_USER_SERVICE_PRINCIPAL }}
ARM_USE_OIDC: true
ARM_USE_AZUREAD: true
TF_IN_AUTOMATION: true

jobs:
tf:
uses: dsb-norge/github-actions-terraform/.github/workflows/terraform-module-ci.yaml@tf-test
secrets: inherit
permissions:
contents: read # required for checkout action.
id-token: write # required for Azre passwodless login
pull-requests: write # required for commenting on PR
with:
terraform-version: "1.9.x"
2 changes: 1 addition & 1 deletion examples/01-basic/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ provider "azurerm" {
module "consumption_budget" {
source = "../../"

app_short_name = "my-azure-app"
app_short_name = "my-budget-basic"
subscription = "sub-name"
environment = "prod"
consumption_budget_amount = 9000 # in local currency of subscription location
Expand Down
2 changes: 1 addition & 1 deletion examples/02-full/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ provider "azurerm" {
module "consumption_budget" {
source = "../../"

app_short_name = "my-azure-app"
app_short_name = "my-budget-full"
subscription = "sub-name"
environment = "prod"
consumption_budget_amount = 9000 # in local currency of subscription location
Expand Down
8 changes: 4 additions & 4 deletions tests/unit-tests.tftest.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@ run "it_should_output_resource_id_for_cost_anomaly_alert" {
cost_anomaly_alert_email_receivers = ["vaild.dummy@epost.her"]
}

assert {
condition = length(output.cost_anomaly_alert_id) > 0
error_message = "Cost anomaly alert id outpout is missing"
}
assert {
condition = length(output.cost_anomaly_alert_id) > 0
error_message = "Cost anomaly alert id outpout is missing"
}
}