GCP
MechCloud's Stateless Infrastructure as Code (IaC) for Google Cloud Platform (GCP) enables you to declaratively manage your GCP resources without relying on state files, eliminating common issues like state drift. By defining your desired infrastructure in YAML and comparing it directly against your live GCP environment, you can provision, update, and delete resources with confidence. This feature supports a range of GCP resources (e.g., VPC networks, subnetworks, firewalls, compute instances, disks, GKE clusters) and integrates real-time pricing to provide proactive cost insights during planning.
For details on resource contexts (equivalent to Kubernetes namespaces for scoping resources), see the Resource Contexts documentation.
Key Concepts
Desired State
The desired state is your YAML blueprint describing the infrastructure you want. It's hierarchical, using nesting to define parent-child relationships (e.g., a subnetwork inside a VPC network).
Requirements:
Each resource must have a unique relative path based on its hierarchy (e.g., vpc1/subnet1/vm1), similar to a Linux file path. This is your responsibility to ensure uniqueness and prevent conflicts.
Use
snake_casefor all properties.No explicit parent references (e.g., no network link for a subnetwork—MechCloud infers from hierarchy).
References:
Sibling references (same parent): ref:<name> (e.g., ref:firewall1).
Non-sibling references (cross-hierarchy): ref:<full_path> (e.g., ref:vpc1/firewall1).
Actual State
The actual state is a real-time snapshot of your GCP resources in the selected context, formatted to match the desired state structure (hierarchical, snake_case properties). It includes resource types, names, identifiers, and properties.
Plan
The plan compares desired and actual states, proposing actions:
Create: New resources.
Update: In-place changes.
Recreate: When at least one immutable property differs (requires delete + create).
Delete: Remove extra resources.
None: No changes needed.
Plans show hierarchy with indentation (-- for children) and include real-time pricing for compute/storage resources (hourly/monthly costs, % change).
Last updated