DEV Community

Shailendra Singh for MechCloud

Posted on

Beyond Terraform & OpenTofu: A Stateless IaC with Real-Time Pricing

If you work with Infrastructure as Code (IaC), you know the challenges that come with tools like Terraform and OpenTofu. The central problem is often the state file. We've all been there: waiting for a lock to be released, fixing merge conflicts on a shared state file, or the bad feeling when you realize your cloud environment is different from what your state file says. This "drift" turns your IaC from a source of truth into a source of problems.

These powerful tools are built on a fragile idea: that you need a separate file to keep track of your infrastructure. This file becomes a single point of failure that makes teamwork harder and adds extra work, like managing storage and access control.

What if we could remove this limitation entirely? What if you could have the power of IaC without the headaches of a state file, on any cloud, and see the costs before you spend a single dollar?

MechCloud is excited to announce a new way to manage infrastructure: our Stateless IaC Engine with Real-Time Pricing. Our tool is designed to work with many clouds, starting with AWS and with Google Cloud Platform (GCP) coming next. It's your chance to move from a difficult, error-prone process to a simple, cost-aware, and truly stateless method.

The End of the State File Era

The main issue with tools like Terraform and OpenTofu is that they force you to maintain a separate, artificial copy of your infrastructure's state. MechCloud's stateless engine avoids this problem by treating the cloud provider (like AWS) as the only source of truth.

It works by directly comparing your desired state (what you define in a simple YAML file) with the actual state (what currently exists in your cloud account). The tool then creates a clear plan to make the actual state match your desired state.

This method immediately solves the most common IaC problems:

  • No More State Drift: Because the tool checks the cloud for the actual state every time, any manual changes are found instantly. There is no "drift" because there is no static state file to be wrong.
  • Easy Teamwork: Forget about state locking. The code in your Git repository is the single source of truth for what you want. Teams can work on different parts of the infrastructure at the same time without causing problems for each other.
  • Simpler and Safer Operations: Remove the complex work of managing remote state files. You no longer need to configure S3 or GCS buckets to store your state.

A Developer-First Syntax You'll Actually Like

We designed our YAML configuration to be powerful but simple. Let's compare.

First, a standard, long CloudFormation template:

Resources:
  Vpc1:
    Type: AWS::EC2::VPC
    Properties:
      CidrBlock: "10.2.0.0/16"
  Sg1:
    Type: AWS::EC2::SecurityGroup
    Properties:
      VpcId: !Ref Vpc1
      GroupDescription: "Allow SSH"
      SecurityGroupIngress:
        - IpProtocol: tcp
          FromPort: 22
          ToPort: 22
          CidrIp: "81.112.212.216/32"
  Subnet1:
    Type: AWS::EC2::Subnet
    Properties:
      VpcId: !Ref Vpc1
      CidrBlock: "10.2.1.0/24"
  Vm1:
    Type: AWS::EC2::Instance
    Properties:
      ImageId: "ami-0bc691261a82b32bc"
      InstanceType: "t3.small"
      SubnetId: !Ref Subnet1
      SecurityGroupIds:
        - !Ref Sg1
Enter fullscreen mode Exit fullscreen mode

Now, see the same infrastructure in MechCloud’s simpler format. The nested structure automatically defines the parent-child relationships, so you don't need to add VpcId manually.

resources:
  - type: aws_ec2_vpc
    name: vpc1
    props:
      cidr_block: "10.2.0.0/16"
    resources:
      - type: aws_ec2_security_group
        name: sg1
        props:
          group_description: "Allow SSH"
          security_group_ingress:
            - ip_protocol: tcp
              from_port: 22
              to_port: 22
              cidr_ip: "81.112.212.216/32"
      - type: aws_ec2_subnet
        name: subnet1
        props:
          cidr_block: "10.2.1.0/24"
        resources:
          - type: aws_ec2_instance
            name: vm1
            props:
              image_id: "ami-0bc691261a82b32bc"
              instance_type: "t3.small"
              security_group_ids:
                - "ref:sg1"
Enter fullscreen mode Exit fullscreen mode

YAML That is Easy to Use: A kyaml-Inspired Approach

We know that for many developers, the biggest problem with YAML is its sensitivity to indentation. A single wrong space can break your entire configuration. To solve this, our engine will use a kyaml-inspired syntax in future. This means that the relationships between resources do not depend only on tricky indentation. This makes your configuration files stronger, easier to check for errors, and simpler to work with, saving you from many formatting problems.

Manage Environments Safely with the Resource Context

In a real project, you manage multiple environments - like development, staging, and production - often in the same cloud account. It is very important to prevent changes in one environment from affecting another. For this, we introduce the Resource Context.

Think of a Resource Context as a Kubernetes namespace for your cloud resources. It is a logical container that groups a set of resources together. This creates a safe boundary for managing your work. For example, for an application named app1, you would create separate contexts:

  • app1-prod for production
  • app1-dev for development
  • app1-stage for staging

When you get ready to run a plan or apply, you choose the context you want to work in. MechCloud will then limit its actions (both checking the actual state and making changes) to only the resources inside that context. This helps you limit the impact of any changes and prevents the common mistake of accidentally changing your production environment.

See Costs Before You Spend: Pricing in Your Plan

For too long, cost has been something you think about later - a problem for the finance team to review at the end of the month. MechCloud changes this by putting real-time pricing directly into the plan step.

Before you ever click "apply," you see exactly how much your changes will cost. When MechCloud creates a plan, it shows the needed actions (Create, Update, Delete, etc.) and the cost impact for any resource.

Imagine your team is deploying a new service. The first plan would look like this:

vpc1 (action: create)
-- sg1 (action: create)
-- subnet1 (action: create)
---- vm1 (action: create, price: $0.0208/Hr, monthly: $15.03, change: +100%)
Enter fullscreen mode Exit fullscreen mode

The plan clearly shows that a new t3.small instance will be created, with its hourly and estimated monthly cost. Now, a developer finds a way to save money and updates the instance type to t3.micro. The new plan gives instant, helpful feedback:

vpc1 (action: none)
-- sg1 (action: none)
-- subnet1 (action: none)
---- vm1 (action: update, price: $0.0104/Hr, monthly: $7.52, change: -50.0%)
Enter fullscreen mode Exit fullscreen mode

This changes everything. Developers now have the ability to make smart cost decisions as they write code. Code reviews can include discussions about cost. Managers can predict spending and avoid surprise bills.

Join the Stateless Movement: Be a Beta User

This is more than just a new feature; it is a new way to manage cloud infrastructure. And we want you to help us build it. We are launching a special beta program by the end of this year, and we need your expert feedback.

By joining our beta, you get more than just early access - you get a voice in our development process. We are looking for skilled engineers to give us feedback and help us build the multi-cloud IaC tool you have always wanted.

Join the MechCloud Discord Server today to:

  • Get Your Spot in the Beta: Be one of the first to try stateless IaC on your own projects.
  • Directly Influence the Product: Your feedback on our syntax and GCP support will directly shape the final tool.
  • Talk with Our Engineering Team: Get your questions answered, share your ideas, and work with the people building the platform.

Stop struggling with state files. Start building infrastructure with confidence and clarity. The future of IaC is stateless and multi-cloud, and it starts now. Join us.

Top comments (0)