Last active
June 28, 2020 18:07
-
-
Save pars3c/2ab2580cd021b6a27d60e656ac53ce03 to your computer and use it in GitHub Desktop.
Terraform file to generate a Dark Web Crawler
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Filename: main.tf | |
# Configure GCP project | |
provider "google" { | |
project = "terraform-cr" | |
} | |
# Deploy image to Cloud Run | |
resource "google_cloud_run_service" "comicbook-crawler" { | |
name = "comicbook-crawler" | |
location = "europe-west2" | |
template { | |
spec { | |
containers { | |
image = "gcr.io/<project_id>/comicbook-crawler" | |
} | |
} | |
} | |
} | |
# Create public access | |
data "google_iam_policy" "noauth" { | |
binding { | |
role = "roles/run.invoker" | |
members = [ | |
"allUsers", | |
] | |
} | |
} | |
# Enable public access on Cloud Run service | |
resource "google_cloud_run_service_iam_policy" "noauth" { | |
location = google_cloud_run_service.mywebapp.location | |
project = google_cloud_run_service.mywebapp.project | |
service = google_cloud_run_service.mywebapp.name | |
policy_data = data.google_iam_policy.noauth.policy_data | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment