Skip to content
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
889d2ac
testing new github username
denniwang Oct 8, 2025
fe338cd
test variable
denniwang Oct 8, 2025
6bd26d7
chore: auto-format terraform and update documentation
github-actions[bot] Oct 8, 2025
8dfa28b
Revert "test variable"
denniwang Oct 8, 2025
46c16d8
Merge branch '19-terraform-github-bugs' of https://github.com/Code-4-…
denniwang Oct 8, 2025
4b9e2da
terraform plan log test
denniwang Oct 8, 2025
1247316
chore: auto-format terraform and update documentation
github-actions[bot] Oct 8, 2025
e945337
Merge branch 'main' into 19-terraform-github-bugs
denniwang Oct 8, 2025
47d6d97
bug that should bug
Yurika-Kan Oct 8, 2025
dac58df
Merge branch '19-terraform-github-bugs' of https://github.com/Code-4-…
denniwang Oct 8, 2025
dbf6ef5
chore: auto-format terraform and update documentation
github-actions[bot] Oct 8, 2025
2db9eba
debug
denniwang Oct 8, 2025
6a6ac2a
chore: auto-format terraform and update documentation
github-actions[bot] Oct 8, 2025
71ce914
failure output before commenting
denniwang Oct 8, 2025
bea6381
Merge branch '19-terraform-github-bugs' of https://github.com/Code-4-…
denniwang Oct 8, 2025
3b34c8b
debug
denniwang Oct 8, 2025
3fdc7a5
create plan txt earlier
denniwang Oct 8, 2025
b840b79
saving file elsewhere
denniwang Oct 8, 2025
f6bded0
test bug fixed
Yurika-Kan Oct 8, 2025
f805787
removed broken code
denniwang Oct 8, 2025
a3511d1
Merge branch '19-terraform-github-bugs' of https://github.com/Code-4-…
denniwang Oct 8, 2025
80b4d21
removed bad github repo
denniwang Oct 8, 2025
a35b49f
formatting
denniwang Oct 8, 2025
2912878
chore: auto-format terraform and update documentation
github-actions[bot] Oct 8, 2025
2c409d4
test no duplicate
Yurika-Kan Oct 8, 2025
36b003d
chore: auto-format terraform and update documentation
github-actions[bot] Oct 8, 2025
06f382c
Revert "test no duplicate"
denniwang Oct 9, 2025
905e1c8
chore: auto-format terraform and update documentation
github-actions[bot] Oct 9, 2025
2d4224c
cleared main.tf
denniwang Oct 9, 2025
50d7f87
Merge branch '19-terraform-github-bugs' of https://github.com/Code-4-…
denniwang Oct 9, 2025
b11c3f0
chore: auto-format terraform and update documentation
github-actions[bot] Oct 9, 2025
58e0c88
Merge branch 'main' into 19-terraform-github-bugs
nourshoreibah Oct 19, 2025
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
41 changes: 38 additions & 3 deletions .github/workflows/terraform-plan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ jobs:
- Auto-formatted .tf files with terraform fmt
- Updated README.md with terraform-docs

Co-authored-by: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>"
Co-authored-by: ${{ github.event.pull_request.user.login }} <${{ github.event.pull_request.user.login }}@users.noreply.github.com>"

git push
fi
Expand Down Expand Up @@ -211,6 +211,18 @@ jobs:
TF_VAR_infisical_client_id: ${{ secrets.INFISICAL_CLIENT_ID }}
TF_VAR_infisical_client_secret: ${{ secrets.INFISICAL_CLIENT_SECRET }}

- name: Show Terraform Plan Output in Workflow
if: always()
run: |
echo "=== Terraform Plan Output (${{ matrix.directory }}) ==="
if [ -f plan_output.txt ]; then
cat plan_output.txt
else
echo "No plan output file found"
fi
echo "=== End Terraform Plan Output ==="
working-directory: ${{ matrix.directory }}

- name: Delete old plan comments
uses: actions/github-script@v7
if: github.event_name == 'pull_request'
Expand Down Expand Up @@ -276,13 +288,36 @@ jobs:
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const fs = require('fs');
const path = require('path');

let planOutput = 'No plan output captured';
try {
// Read from the existing plan_output.txt file
const planFile = path.join('${{ matrix.directory }}', 'plan_output.txt');
if (fs.existsSync(planFile)) {
planOutput = fs.readFileSync(planFile, 'utf8');
console.log('Successfully read plan output from plan_output.txt');
} else {
console.log('plan_output.txt not found');
}
} catch (error) {
console.log('Error reading plan output file:', error.message);
}

const output = `#### Terraform Plan Failed ❌ \`${{ matrix.directory }}\`
#### Terraform Initialization ⚙️\`${{ steps.init.outcome }}\`
#### Terraform Validation 🤖\`${{ steps.validate.outcome }}\`

*Pushed by: @${{ github.actor }}, Action: \`${{ github.event_name }}\`*
<details><summary>Show Error Details</summary>

\`\`\`terraform
${planOutput}
\`\`\`

</details>

Check the workflow logs for more details.`;
*Pushed by: @${{ github.event.pull_request.user.login }}, Action: \`${{ github.event_name }}\`*`;

github.rest.issues.createComment({
issue_number: context.issue.number,
Expand Down
1 change: 0 additions & 1 deletion infrastructure/github/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ resource "github_branch_protection" "main" {
enforce_admins = false
}


resource "github_repository_collaborator" "collaborators" {
for_each = { for c in var.repository_collaborators : c.username => c }
repository = github_repository.branch.name
Expand Down
1 change: 1 addition & 0 deletions infrastructure/test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ No modules.
| Name | Type |
|------|------|
| [aws_instance.example](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/instance) | resource |
| [aws_instance.web](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/instance) | resource |

## Inputs

Expand Down
7 changes: 7 additions & 0 deletions infrastructure/test/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,11 @@ resource "aws_instance" "example" {
tags = {
Name = "HelloWorld"
}
}

# This resource creates an EC2 instance for the web application
# It uses the latest Amazon Linux 2 AMI and t3.micro instance type
resource "aws_instance" "web" {
ami = "ami-12345678"
instance_type = "t3.micro"
}
2 changes: 1 addition & 1 deletion infrastructure/test/providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ terraform {

provider "aws" {
region = "us-east-2"
}
}