Zum Hauptinhalt springen
Echtzeit-Radar & Feeds
Alle RSS Feeds ➔
👥 Community & Social
Windows Tipps & SecurityGrafikkarte vor Überhitzung schützen: So geht’s(25.09.2026 um 08:00 Uhr)
••••••••••
Windows Tipps & SecurityGrafikkarte vor Überhitzung schützen: So geht’s(25.09.2026 um 08:00 Uhr)
••••••••••
Intelligence View
⚡ tsecurity.de Intelligence

Terraform: How to Deploy Compute Engine, Network, and Subnet with Terraform on GCP

I'm exited to share with you a comprehensive guide on deploying compute engine, network and Subnet on GCP using terraform. This guide will walk you through the process of setting up robust infrastructure on GCP using terraform's…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

I'm exited to share with you a comprehensive guide on deploying compute engine, network and Subnet on GCP using terraform. This guide will walk you through the process of setting up robust infrastructure on GCP using terraform's infrastructure-as-a-code (Iac) approach.



Prerequisite



Before we dive in, make sure you have:




  • A GCP account with billing enabled

  • Terraform installed on your machine



Step 1: Create a file




  • Create a file on your laptop, name it terraform project

  • Right click on the file and open it with VS code.

  • Create a provider.tf file once you open your VS code



Step 2: Deployment




  • Go to your browser and search for terraform provider

  • Click on GCP (because we are deploying the resources to GCP)






  • Click on use provider

  • Then copy provider command






  • Go to your VS code, click on the provider.tf file and paste the provider command you copied



Step 3: Creating a system user for terraform on GCP




  • Go to your GCP dashboard

  • Click on the 3 lines by your left

  • Put your cursor on IAM & admin, and click on service account

  • Click on create service account at the top

  • Let's name it terraform automation

  • Scroll down and click create

  • Click select a role under grant this service account

  • Put your cursor on basic and select owner

  • Click on continue

  • Click done

  • After creating it, click on it

  • Click on key at your top

  • Click add key, and click create new key

  • Choose Json and click create
    The private key will be downloaded to your laptop

  • Go to your downloads in your laptop

  • Locate the private key and right click on it, and copy it

  • Open that terraform project file you created on your laptop and paste the private key you copied

  • Go to your VS code, you will see the key

  • Right click on the key and rename it to something short (e.g gcp-key)

  • Click on your provider.tf file

  • In line 10, type provider "google"{

  • In line 11, type #configuration options

  • Line 12, type project ="go to your google dashboard, click on project at the top, copy the project id and paste it here"

  • Line 13, type region ="paste your region"

  • Line 14, type credentials =file("gcp-key.json")
    -Line 15, put}

  • save


  • Go to your terraform provider on your browser


  • Click on documentation

    -Search google compute network


  • Copy the code under network custom MTU







  • Go to your VS code, create a vpc.tf file and paste the command you copied

  • Change my-project name to anything you want (e.g gcp project)

  • Where you see vpc-network ( front of name) name it to whatever you want or leave it

  • Change true to false (because this is a customized VPC)

  • save



Step 4: Subnet Creation




  • Create a file in your VS code and name it subnet.tf

  • Go to your terraform provider documentation

  • Search google compute subnet

  • Copy the command and paste it in the subnet.tf






  • Delete from resource "google_compute_network" to false}

  • Where you see "test-subnetwork" name it anything or leave it default

  • Change the region to your region

  • Change custom-test to vpc_network.id or anything

  • save



Step 5: Firewall Creation




  • Create a file in your VS code and name it firewall.tf

  • Go to your terraform provider documentation

  • Search for google compute firewall






  • Copy the command and paste it in firewall.tf

  • Where you see default, in front of network=, change it to vpc_network.name

  • Where you see 8080, change it to 22, leave 80, remove 1000-2000 and replace it with 443

  • Where you see test-firewall, change it to frontend firewall or anything

  • Where you see "web", change it to Frontend

  • Save



Step 6: Create Virtual Machine




  • Create a file, name it instance.tf

  • Go to your terraform provider documentation

  • Search google compute instance






  • Copy the command and paste it in instance.tf

  • Where you see "default" in the first line, change it to "web-app" or anything you want

  • Where you see "my-custom-sa" in front of account_id, change it to "web-sa"

  • Where you see "my-instance" in line 7, change it "frontend-web-app" or anything you want

  • Zone in line 9, put your zone

  • Line 11, (tags), change those things to ("frontend")

  • Line 28 (network), remove default and put google-compute-network.vpc_network

  • In line 36 (foo), remove "bar" and replace it with "web"

  • Line 39, you can remove the "echo hi>/test txt" and put "sudo apt install nginx" or leave it

  • Line 43, remove default, and replace it with the terraform system account id/

  • save


  • Type terraform validate (to check for any possible error)


  • Type terraform plan


  • Type apply --auto-approve or terraform apply


  • When you are done with your deployment, type terraform destroy




Conclusion



In this guide, we have successfully deployed a Compute Engine Instance, Network and Subnet on GCP using terraform. You can now use this infrastructure as a starting point for your project and scale it as needed.



See you soon...

1. Sofort-Triage & Abwehrmaßnahmen

SOC Incident Playbook: Remote Code Execution (RCE) Defense
Syntax validiert (0 Fehler)
title: Detect Exploitation - Terraform: How to Deploy Compute Engine, Network, and Subnet with Terraform on GCP
id: c5232a7a-da04-45c8-8e25-870781a7056f
status: experimental
description: Automatisch generierte SIEM-Erkennungsregel basierend auf CTI Intelligence
references:
  - https://tsecurity.de/
author: iShareStuff CTI Automated Detection Engine
date: 2026-09-26
logsource:
  category: network_connection
  product: any
detection:
  selection:
      CommandLine|contains:
        - 'exploit'
  condition: selection
falsepositives:
  - Legitime administrative Zugriffe oder Penetrationstests
level: high
tags:
  - attack.initial_access
Syntax validiert (0 Fehler)
rule CTI_Threat_Indicator {
    meta:
        author = "iShareStuff CTI Automated Detection Engine"
        date = "2026-09-26"
        description = "YARA Signature for "
    strings:
        $str = "Terraform: How to Deploy Compu" ascii wide
    condition:
        any of them
}
Syntax validiert (0 Fehler)
index=security sourcetype IN ("cisco:asa", "pan:traffic", "zeek_conn", "suricata", "WinEventLog:Security")
("Terraform How to Deploy Compute Engine N")
| stats count earliest(_time) as first_seen latest(_time) as last_seen by src_ip, dest_ip, dest_host, signature
| eval first_seen=strftime(first_seen, "%Y-%m-%d %H:%M:%S"), last_seen=strftime(last_seen, "%Y-%m-%d %H:%M:%S")
| sort - count
Syntax validiert (0 Fehler)
message: "*Terraform How to Deploy Compute Engine N*"
Syntax validiert (0 Fehler)
CommonSecurityLog
| where Message has "Terraform How to Deploy Compute Engine N"
| summarize EventCount = count(), FirstSeen = min(TimeGenerated), LastSeen = max(TimeGenerated) by SourceIP, DestinationIP, DestinationPort, Activity
| extend DetectionRule = "iShareStuff-CTI-Compiled"
| sort by EventCount desc

2. Cyber Threat Intelligence & Forensik

CTI Threat Relationship Graph3 Knoten / 2 Relationen
CVE / Incident Software MITRE ATT&CK CWE Weakness IoC
🎯
MITRE ATT&CK Matrix Navigator 14 Taktiken
Reconnaissance
-
Resource Development
-
Initial Access
Execution
Persistence
-
Privilege Escalation
Defense Evasion
Credential Access
-
Discovery
-
Lateral Movement
-
Collection
-
Command and Control
Exfiltration
-
Impact
tsecurity.de Cognitive Threat RAG
Fokus-Vektor:

Kognitive Analyse für identifizierte Bedrohung: Erhöhte Bedrohungslage im Bereich Terraform: How to Deploy Compute Engine,.... Basierend auf 368k Vektor-Korrelationen werden sofortige Isolationsmaßnahmen für betroffene Endpunkte empfohlen.

🛡️ Angriffsfläche & Exposure

Netzwerk/Remote-Zugriff ohne Vorauthentifizierung möglich.

⚡ Empfohlene Sofortmaßnahmen
  • 1. Perimeter-Inspektion: Relevante Portfreigaben und exponierte Endpunkte unverzüglich scannen.
  • 2. Patch-Applikation: Hersteller-Hotfix einspielen oder betroffene Daemons in isolierte DMZ-Segmente überführen.
  • 3. Telemetrie & EDR-Alerts: Prozessaufrufe und Child-Processes auf anomale Shell-Spawns überwachen.
🔗 Semantisch verwandte Zero-Days MariaDB 11.7 VEC
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Terraform: How to Deploy Compute Engine, Network, and Subnet with Terraform on GCP

Thematisch verwandte Begriffe: Terraform, Deploy, Compute, Engine · 6 Treffer

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-88003 | InvoicePlane is a self-hosted open source application for managing invoi…
Advisory →
tsecurity.de Icon
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag