Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
bregman-arie committed Oct 23, 2022
1 parent d2f681f commit 7cceb86
Show file tree
Hide file tree
Showing 17 changed files with 672 additions and 318 deletions.
320 changes: 2 additions & 318 deletions README.md

Large diffs are not rendered by default.

Binary file added images/logos/datadog.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions topics/datadog/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# DataDog

## Questions

TODO
452 changes: 452 additions & 0 deletions topics/gcp/README.md

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions topics/gcp/exercises/assign_roles/exercise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Assign Roles

## Objectives

1. Assign the following roles to a member in your organization
1. Compute Storage Admin
2. Compute Network Admin
3. Compute Security Admin
2. Verify roles were assigned

## Solution

Click [here](solution.md) to view the solution
19 changes: 19 additions & 0 deletions topics/gcp/exercises/assign_roles/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
locals {
roles = [
"roles/compute.storageAdmin",
"roles/compute.networkAdmin",
"roles/compute.securityAdmin"
]
}

resource "google_service_account" "some_member" {
account_id = "${substr(var.env_id, 0, min(length(var.env_id), 10))}-some-member"
display_name = "${var.env_id} some-member"
}

resource "google_project_iam_member" "storageAdminMaster" {
for_each = toset(concat(local.roles))
project = "${var.project_id}"
role = each.key
member = "serviceAccount:${google_service_account.some_member.email}"
}
23 changes: 23 additions & 0 deletions topics/gcp/exercises/assign_roles/solution.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Assign Roles

## Objectives

1. Assign the following roles to a member in your organization
1. Compute Storage Admin
2. Compute Network Admin
3. Compute Security Admin
2. Verify roles were assigned

## Solution

### Console

1. Go to IAM & Admin
2. Click on IAM and then on the "Add" button
1. Choose the member account to whom the roles will be added
2. Under select role, search for the specified roles under "Objectives" and click on "Save"
2. The member should now be able to go to the compute engine API and see the resources there.

### Terraform

Click [here](main.tf) to view the Terraform main.tf file
7 changes: 7 additions & 0 deletions topics/gcp/exercises/assign_roles/vars.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
variable "project_id" {
type = string
}

variable "env_id" {
type = string
}
10 changes: 10 additions & 0 deletions topics/gcp/exercises/assign_roles/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
terraform {
required_version = ">=1.3.0"

required_providers {
google = {
source = "hashicorp/google"
version = ">= 4.10.0, < 5.0"
}
}
}
9 changes: 9 additions & 0 deletions topics/gcp/exercises/create_project/exercise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Create a Project

## Objectives

1. Create a project with a unique name

## Solution

Click [here](solution.md) to view the solution
10 changes: 10 additions & 0 deletions topics/gcp/exercises/create_project/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
resource "google_project" "gcp_project" {
name = "Some Project"
project_id = "some-unique-project-id"
folder_id = google_folder.some_folder.name
}

resource "google_folder" "some_folder" {
display_name = "Department 1"
parent = "organizations/some-organization"
}
19 changes: 19 additions & 0 deletions topics/gcp/exercises/create_project/solution.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Create a Project

## Objectives

1. Create a project with a unique name

## Solution

### Console

1. Click in the top bar on "New Project" (if you already have a project then, click on the project name and then "New Project") or in the search bar insert "Create Project".
2. Insert a globally unique project name
3. Optionally choose an organization
4. Optionally put it under a specific folder
5. Click on "Create" :)

### Terraform

Click [here](main.tf) to view the solution
10 changes: 10 additions & 0 deletions topics/gcp/exercises/create_project/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
terraform {
required_version = ">=1.3.0"

required_providers {
google = {
source = "hashicorp/google"
version = ">= 4.10.0, < 5.0"
}
}
}
17 changes: 17 additions & 0 deletions topics/gcp/exercises/instance_101/exercise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Create an Instance

## Objectives

1. Create a VM instance with the following properties
1. name: instance-1
2. type: e2-micro
3. labels:
1. app: web
2. env: dev
2. Using the CLI (gcloud) perform the following operations:
1. Update "app" label to "db"
2. Remove "env" label

## Solution

Click [here](solution.md) to view the solution
21 changes: 21 additions & 0 deletions topics/gcp/exercises/instance_101/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
resource "google_compute_network" "vpc_network" {
name = "my-custom-mode-network"
auto_create_subnetworks = false
mtu = 1460
}

resource "google_compute_subnetwork" "default" {
name = "my-custom-subnet"
ip_cidr_range = "10.0.1.0/24"
region = "us-west1"
network = google_compute_network.vpc_network.id
}

resource "google_compute_instance" "default" {
name = "instance-1"
machine_type = "e2-micro"
zone = "us-west1-a"
labels = {
app = "db"
}
}
45 changes: 45 additions & 0 deletions topics/gcp/exercises/instance_101/solution.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Create an Instance

## Objectives

1. Create a VM instance with the following properties
1. name: instance-1
2. type: e2-micro
3. labels:
1. app: web
2. env: dev
2. Using the CLI (gcloud) perform the following operations:
1. Update "app" label to "db"
2. Remove "env" label

## Solution

### Console

1. Go to Compute Engine -> VM instances
2. Click on "Create Instance"
1. Insert the name "instance-1"
2. Click on "Add label" and add the following labels:
1. app: web
2. env: dev
3. Choose machine type: e2-micro
3. Click on "Create"
4. Selected the created instance and click on "show info panel"
1. Click on "labels" tab and change the value of "app" label to "db"
2. Remove the "env" label

### Shell

```
gcloud config set project <PROJECT_ID>
gcloud config set compute/region <REGION NAME>
gcloud config set compute/zone <ZONE NAME>
gcloud compute instances create instance-1 --labels app=web,env=dev --machine-type=e2-micro
gcloud compute instances update instance-1 --update-labels app=db
gcloud compute instances update instance-1 --remove-labels env
```

### Terraform

Click [here](main.tf) to view the main.tf file
10 changes: 10 additions & 0 deletions topics/gcp/exercises/instance_101/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
terraform {
required_version = ">=1.3.0"

required_providers {
google = {
source = "hashicorp/google"
version = ">= 4.10.0, < 5.0"
}
}
}

0 comments on commit 7cceb86

Please sign in to comment.