mirror of
https://github.com/multipleof4/git.planetrenox.com.git
synced 2026-01-13 16:07:55 +00:00
Create main.tf
This commit is contained in:
42
terraform/main.tf
Normal file
42
terraform/main.tf
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
resource "google_project_service" "compute" {
|
||||||
|
project = var.project_id
|
||||||
|
service = "compute.googleapis.com"
|
||||||
|
disable_on_destroy = false
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "google_compute_firewall" "gitea_allow" {
|
||||||
|
name = "allow-gitea-3000-ssh"
|
||||||
|
network = "default"
|
||||||
|
direction = "INGRESS"
|
||||||
|
allow {
|
||||||
|
protocol = "tcp"
|
||||||
|
ports = ["22", "3000"]
|
||||||
|
}
|
||||||
|
source_ranges = ["0.0.0.0/0"]
|
||||||
|
target_tags = ["gitea"]
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "google_compute_instance" "gitea" {
|
||||||
|
name = "gitea"
|
||||||
|
machine_type = "e2-micro"
|
||||||
|
tags = ["gitea"]
|
||||||
|
boot_disk {
|
||||||
|
initialize_params {
|
||||||
|
image = "projects/fedora-cloud/global/images/family/fedora-cloud-base"
|
||||||
|
size = 30
|
||||||
|
type = "pd-standard"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
network_interface {
|
||||||
|
network = "default"
|
||||||
|
access_config {}
|
||||||
|
}
|
||||||
|
metadata = {
|
||||||
|
startup-script = file("${path.module}/startup.sh")
|
||||||
|
}
|
||||||
|
depends_on = [google_project_service.compute]
|
||||||
|
}
|
||||||
|
|
||||||
|
output "external_ip" {
|
||||||
|
value = google_compute_instance.gitea.network_interface[0].access_config[0].nat_ip
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user