CLI Overview and Prequisites

The Cloudscript CLI helps you convert, plan, deploy, and manage your infrastructure efficiently. See the "Get Started" page to ensure your environment is properly set up.

Infrastructure as Code (IaC) Directory

When you convert a .cloud configuration, the CLI generates standardized infrastructure code in an IaC directory. This includes:

  • Terraform configurations for cloud resources

  • Kubernetes manifests for container orchestration

  • Ansible playbooks for configuration management

File References

The CLI supports referencing external files within your .cloud configuration using the file() function. This is particularly useful for:

  • IAM policies

  • Configuration files

  • Scripts

  • Other JSON/YAML resources

Example:

\\ .cloud file
iam "eks_cluster" {
  name               = "eks_cluster"
  assume_role_policy = file("role.json")
  resource_type      = "aws_iam_role"
}

\\ role.json
{
    "Version": "2012-10-17",
    "Statement": [
      {
        "Effect": "Allow",
        "Principal": {
          "Service": "eks.amazonaws.com"
        },
        "Action": "sts:AssumeRole"
      }
    ]
  }

Prerequisites

Before using the Cloudscript CLI, ensure you have the following installed:

  • Terraform (latest version recommended)

  • Kubernetes CLI (kubectl)

  • Ansible

  • Python 3.6 or later

  • Docker (for local testing)

  • AWS CLI (configured with appropriate credentials)

  • GCP CLI (if using Google Cloud Platform)

AWS Configuration

The CLI requires proper AWS credentials configuration. You can set this up by:

  1. Installing the AWS CLI

  2. Running aws configure

  3. Providing your AWS access key ID and secret access key

GCP Configuration

For Google Cloud Platform:

  1. Install the Google Cloud SDK

  2. Run gcloud auth login

  3. Set your default project with gcloud config set project PROJECT_ID

Directory Structure

When working with Cloudscript, maintain the following directory structure for optimal operation:

project/
├── cloud/               # Cloud configuration directory
│   ├── main.cloud       # Main cloud configuration file
│   ├── role.json
│   └── other-configs/   # Other configuration files
└── IaC/                 # Generated infrastructure code (created by convert)
    ├── main.tf.json     
    ├── resources.yml
    ├── playbook.yml
    ├── inventory.yml
    └── .keys/

Last updated