Terraform Quick Start
Simfra works with the standard Terraform AWS provider. No special provider configuration, skip_* flags, or endpoints block is needed - just set AWS_ENDPOINT_URL.
Prerequisites
- Simfra running on
localhost:4599(see Installation) - Terraform 1.6+ installed
1. Set Environment Variables
export AWS_ENDPOINT_URL=http://localhost:4599
export AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE
export AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
export AWS_DEFAULT_REGION=us-east-1
export AWS_S3_USE_PATH_STYLE=true
2. Create a Configuration
Create a main.tf file:
provider "aws" {
region = "us-east-1"
}
resource "aws_vpc" "main" {
cidr_block = "10.0.0.0/16"
tags = {
Name = "simfra-vpc"
}
}
resource "aws_subnet" "public" {
vpc_id = aws_vpc.main.id
cidr_block = "10.0.1.0/24"
tags = {
Name = "simfra-public-subnet"
}
}
output "vpc_id" {
value = aws_vpc.main.id
}
output "subnet_id" {
value = aws_subnet.public.id
}
The provider block is identical to what you'd use with real AWS. All routing is handled by the AWS_ENDPOINT_URL and AWS_S3_USE_PATH_STYLE environment variables - no provider modifications needed.
3. Init, Plan, Apply
terraform init
terraform plan
terraform apply
Terraform provisions the VPC and subnet against Simfra. The output shows the resource IDs:
Apply complete! Resources: 2 added, 0 changed, 0 destroyed.
Outputs:
vpc_id = "vpc-0abc1234def56789a"
subnet_id = "subnet-0abc1234def56789a"
4. Verify
Confirm the resources exist:
aws ec2 describe-vpcs --filters Name=tag:Name,Values=simfra-vpc
aws ec2 describe-subnets --filters Name=tag:Name,Values=simfra-public-subnet
Or open the Web Console and navigate to VPC to see the resources.
5. Destroy
terraform destroy
Terraform State
Terraform state is stored locally by default (in terraform.tfstate). Since Simfra is a local environment, this is usually fine. If using SIMFRA_DATA_DIR for persistence, Simfra resources survive restarts and stay in sync with your state file.
Next Steps
- AWS CLI and Tools - configure other tools and SDKs
- Credentials - create IAM users for more realistic testing