Skip to content
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
6 changes: 6 additions & 0 deletions .github/workflows/go-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ name: Go CI
on:
pull_request:
branches: [ master ]
paths:
- 'app_go/**'
- '.github/workflows/go-ci.yml'
- '!app_go/docs/**'
- '!app_go/README.md'
- '!**.gitignore'
push:
paths:
- 'app_go/**'
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/python-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ name: Python CI
on:
pull_request:
branches: [ master ]
paths:
- 'app_python/**'
- '.github/workflows/python-ci.yml'
- '!app_python/docs/**'
- '!app_python/README.md'
- '!**.gitignore'
push:
paths:
- 'app_python/**'
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/terraform-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Terraform CI

on:
pull_request:
branches: [ master ]
paths:
- 'terraform/**'

jobs:
validate:
name: Validate terraform configuration
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup terraform
uses: hashicorp/setup-terraform@v3

- name: Check formatting
run: terraform fmt -check

- name: Initialize terraform
run: terraform init

- name: Validate syntax
run: terraform validate

- name: Setup terraform linter
uses: terraform-linters/setup-tflint@v6

- name: Lint terraform
run: tflint

- name: GitHub Integration
run: |
cd ./terraform
export GITHUB_TOKEN=${{ secrets.TERRAFORM_GITHUB_TOKEN }}
terraform import github_repository.course_repo DevOps-Core-Course
terraform plan
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,18 @@
*.xml

# Terraform
*.tfstate
*.tfstate.*
.terraform/
terraform.tfvars

# Pulumi
pulumi/venv/
Pulumi.*.yaml

# IDE
.vscode/
.idea/

# OS
.DS_Store
7 changes: 0 additions & 7 deletions app_go/.gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,2 @@
# Golang
infoService

# IDE
.vscode/
.idea/

# OS
.DS_Store
7 changes: 0 additions & 7 deletions app_python/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,3 @@ __pycache__/
venv/
*.log
.coverage

# IDE
.vscode/
.idea/

# OS
.DS_Store
43 changes: 43 additions & 0 deletions docs/LAB04.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Local VM
VM Provider: Virtual Box

Network: NAT with port forwarding (2222:22) to allow ssh

![Working VM](./screenshots/vm.png)
![VM ssh connection](./screenshots/ssh.png)

# Lab 5 Prep
VM for Lab 5:

No, I am not keeping VM

I will use local VM

# Bonus tasks
![Passing validation](./screenshots/pass.png)
![Failing validation](./screenshots/fail.png)

## Import process
**1. Installing GitHub Provider:**
**3. Create Personal Access Token:**
**4. Configure Token:**
**5. Configure Repository Resource:**
**6. Import**

## Terminal output of import
![Output](./screenshots/import.png)

## Why import
Import brings existing resources into Terraform management:
1. Write Terraform config describing the resource
2. Run `terraform import` to link config to real resource
3. Terraform now manages that resource
4. Future changes go through Terraform

**Advantages of Managing Existing Resources with IaC:**
**1. Version Control:**
**2. Consistency:**
**3. Automation:**
**4. Documentation:**
**5. Disaster Recovery:**
**6. Team Collaboration:**
Binary file added docs/screenshots/fail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/screenshots/pass.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/screenshots/ssh.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/screenshots/vm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions terraform/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
terraform {
required_providers {
github = {
source = "integrations/github"
version = "~> 5.0"
}
}
}

provider "github" {
token = var.github_token # Personal access token
}

resource "github_repository" "course_repo" {
name = "DevOps-Core-Course"
description = "DevOps course lab assignments"
visibility = "public"

has_issues = true
has_wiki = false
has_projects = false
}
4 changes: 4 additions & 0 deletions terraform/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
variable "github_token" {
description = "Token for github integration"
type = string
}
Loading