Skip to content

Commit

Permalink
Fix GitHub and Resource Provider for plan
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredfholgate committed Nov 9, 2023
1 parent 21e0e5d commit 2ba348c
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion bootstrap/modules/github/repository.tf
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ resource "github_branch_protection" "alz" {
required_pull_request_reviews {
dismiss_stale_reviews = true
restrict_dismissals = true
required_approving_review_count = 1
required_approving_review_count = length(var.approvers) > 1 ? 1 : null
}
}
19 changes: 5 additions & 14 deletions templates/.ci_cd/.github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,24 +61,19 @@ jobs:
- name: Terraform Plan
id: plan
run: terraform plan -no-color -input=false
continue-on-error: true

run: terraform plan -input=false

- name: Update Pull Request
if: github.event_name == 'pull_request'
if: (success() || failure()) && github.event_name == 'pull_request'
uses: actions/github-script@v6
env:
PLAN: "terraform\n$${{ steps.plan.outputs.stdout }}"
with:
github-token: $${{ secrets.GITHUB_TOKEN }}
script: |
const output = `#### Terraform Plan 📖\`$${{ steps.plan.outcome }}\`
<details><summary>Show Plan</summary>
<details><summary>Run details</summary>
\`\`\`\n
$${process.env.PLAN}
\`\`\`
The plan was a $${{ steps.plan.outcome }} see the action for more details.
</details>
Expand All @@ -90,7 +85,3 @@ jobs:
repo: context.repo.repo,
body: output
})
- name: Terraform Plan Status
if: steps.plan.outcome == 'failure'
run: exit 1
11 changes: 7 additions & 4 deletions templates/basic/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,20 @@ terraform {
}

provider "azurerm" {
skip_provider_registration = true
features {}
}

provider "azurerm" {
alias = "management"
subscription_id = var.subscription_id_management
alias = "management"
subscription_id = var.subscription_id_management
skip_provider_registration = true
features {}
}

provider "azurerm" {
alias = "connectivity"
subscription_id = var.subscription_id_connectivity
alias = "connectivity"
subscription_id = var.subscription_id_connectivity
skip_provider_registration = true
features {}
}
11 changes: 7 additions & 4 deletions templates/complete/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,20 @@ terraform {
}

provider "azurerm" {
skip_provider_registration = true
features {}
}

provider "azurerm" {
alias = "management"
subscription_id = var.subscription_id_management
skip_provider_registration = true
alias = "management"
subscription_id = var.subscription_id_management
features {}
}

provider "azurerm" {
alias = "connectivity"
subscription_id = var.subscription_id_connectivity
skip_provider_registration = true
alias = "connectivity"
subscription_id = var.subscription_id_connectivity
features {}
}
11 changes: 7 additions & 4 deletions templates/hubnetworking/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,20 @@ terraform {
}

provider "azurerm" {
skip_provider_registration = true
features {}
}

provider "azurerm" {
alias = "management"
subscription_id = var.subscription_id_management
skip_provider_registration = true
alias = "management"
subscription_id = var.subscription_id_management
features {}
}

provider "azurerm" {
alias = "connectivity"
subscription_id = var.subscription_id_connectivity
skip_provider_registration = true
alias = "connectivity"
subscription_id = var.subscription_id_connectivity
features {}
}

0 comments on commit 2ba348c

Please sign in to comment.