ops0ops0

GitHub Sync

Push code to GitHub, create pull requests, and keep infrastructure in version control.

Why GitHub Sync?

Prerequisites

Connect Repository

Click GitHub Button

Click the GitHub button in the toolbar.

Select Repository

Select existing repo or create new one.

Choose Branch

Choose branch (e.g., main).

GitHub Actions

Click the GitHub dropdown to:

ActionDescription
Push to GitHubCommit and push changes
Sync from GitHubPull remote changes
Check PR StatusView open PR status
View PR on GitHubOpen PR in browser

Status Indicators

IndicatorMeaning
Green checkmarkSynced with GitHub
Orange dotUnpushed local changes
Blue arrowRemote changes to pull
Red warningConflicts or errors

Create Pull Request

Instead of pushing directly to main:

Open Pull Request Flow

Click GitHubCreate Pull Request in the toolbar.

Enter Details

Enter branch name (e.g., feature/add-rds), title, and description.

Create

Click Create to open the PR.

This creates a new branch and opens a PR for review.

Handling Conflicts

If conflicts exist:

OptionWhat it does
Keep LocalUse your version
Keep RemoteUse GitHub's version
MergeManually combine changes
**/.terraform/*
*.tfstate
*.tfstate.*
*.tfvars
*.tfvars.json
crash.log
override.tf
override.tf.json
.terraformrc
terraform.rc
Best Practices
  • Commit after each logical change
  • Use descriptive commit messages
  • Create PRs for code review
  • Never commit secrets or .tfvars with sensitive data

Example: Team Collaboration Workflow

Scenario

You're adding an RDS database to your infrastructure. Another team member is updating the security groups in the same project.

Your Workflow

Sync First

Click GitHubSync to pull teammate's changes.

Create Branch

GitHub → Create Pull Request → Name: feature/add-rds

Make Changes

Use AI chat to create the RDS configuration.

Push

Click GitHubPush to update the PR.

Review

Teammate reviews PR on GitHub, approves.

Merge

PR merges to main, Deploy from main branch.

Commit History

main
├── a1b2c3d Add VPC and subnets (initial setup)
├── d4e5f6g Add security groups (teammate)
└── g7h8i9j [PR #12] Add RDS PostgreSQL instance (you)

PR Description Example

## Add RDS PostgreSQL Instance

Adds a managed PostgreSQL database for the application.

**Resources:**
- `aws_db_instance.main` - PostgreSQL 15.4 on db.t3.medium
- `aws_db_subnet_group.main` - Uses existing private subnets
- `aws_security_group.db` - Allows 5432 from app security group

**Cost Impact:** +$51.30/month

**Testing:**
- [ ] Validate passes
- [ ] Plan shows expected resources
- [ ] Security group rules are correct