Skip to content

Instantly share code, notes, and snippets.

resource "google_project_service" "api_services" {
project = var.project_id
for_each = toset(
[
"iam.googleapis.com",
"compute.googleapis.com",
"cloudresourcemanager.googleapis.com",
]
)
service = each.key
#! /bin/bash
curl -sSO https://dl.google.com/cloudagents/add-logging-agent-repo.sh
sudo bash add-logging-agent-repo.sh --also-install
sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl gnupg2 software-properties-common
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add --
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian buster stable"
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
sudo usermod -a -G docker $USER
variable "project_id" {
description = "GCP Project ID"
type = string
}
variable "region" {
description = "GCP Region"
type = string
}
@danilo-nzyte
danilo-nzyte / main.tf
Created February 19, 2023 05:00
main.tf
terraform {
required_providers {
google = {
source = "hashicorp/google"
version = "4.49.0"
}
}
}
provider "google" {
resource "google_cloudbuild_trigger" "fn-ram-api-request" {
location = "europe-west1"
name = "build-fn-ram-api-request"
filename = "4_continuous_deployment/fn_ram_api_request/ci-cd/cloudbuild.yaml"
substitutions = {
_SERVICE_ACCOUNT = google_service_account.real-world-python.email
}
github {
owner = "danilo-nzyte"
name = "real_world_python_tutorials"
output "prefect_service_account_key" {
value = google_service_account_key.prefect_service_account_key.private_key
sensitive = true
}
#!/bin/bash
curl -sSO https://dl.google.com/cloudagents/install-logging-agent.sh sudo bash install-logging-agent.sh
sudo apt-get update -y
sudo apt-get upgrade -y
sudo apt-get install -y \
ca-certificates \
curl \
gnupg \
lsb-release \
software-properties-common \
resource "google_project_service" "api_services" {
project = var.project_id
for_each = toset(
[
"iam.googleapis.com",
"compute.googleapis.com",
"bigquery.googleapis.com",
"run.googleapis.com",
"cloudfunctions.googleapis.com",
"artifactregistry.googleapis.com",
project_id = "real-world-python-tf"
region = "europe-west2"
zone = "europe-west2-b"
prefect_api_key = "INSERT_PREFECT_API_KEY"
prefect_workspace = "INSERT_PREFECT_USER/INSERT_PREFECT_WORKSPACE_NAME"
variable "project_id" {
description = "GCP Project ID"
type = string
}
variable "region" {
description = "GCP Region"
type = string
}