Prerequisites
1
Configure publicly accessible URL
Opentaco services expected to be publicly accessible for oauth flow to function correctly.
OPENTACO_PUBLIC_BASE_URL
is the env variable where you expect your service to be hosted that is public facing.If you are running a load balancer, it is the public side of that load balancer.If its a single server, it is the public endpoint.If you are running it through ngrok on your local machine it is the ngrok url, not localhost.2
Setup Auth provider
Navigate to https://auth0.com, create an account and sign in.You’re going to want to create a native app. Once you do that it’ll take you to a screen where you can select a technology - we don’t need this. You can instead go to settings.In the settings tab take note of the domain, client id and client secret. Feel free to store them in environment variables as follows:In the settings tab scroll down to callback urls and add the following callback url:
http://127.0.0.1:8585/callback
You also need to set this value: https://OPENTACO_PUBLIC_BASE_URL/oauth/oidc-callback
After you added both values hit save changesOnce we have these values we can export them in our .zshrc
, .bashrc
, .profile
, .zprofile
or whatever is applicable on your platform.3
Setup Cloud provider
Statesman relies on an S3 compatible storage, in case of AWS we will need to have an S3 Bucket. You can create
an S3 bucket using the AWS Console or using the AWS CLI. Take note of your bucket name as we will need it
in future steps.In addition we will be needing aws cli credentials to be configured for Statesman to be able to access the S3 bucket.
Configure a set of credentials and make note of the following values:
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
AWS_DEFAUlT_REGION
Configure Statesman Backend
The first component we want to configure is the statesman backend, this will be the main gatekeeper for all your state management, enforcing proper management for all users and systems requiring access to state.1
Setup Env file
The next thing you’ll want to do is to setup Statesman - the state management service.First we’ll want to make an env file for your service.We’ll need the values from the settings page of our Auth0 application:Then we need to create two more:Note that these are specific to Auth0, if you use another provider they may use different endpoints. That is why they are defined separately and not computed.The next values we need are from S3:And lastly the
OPENTACO_PUBLIC_BASE_URL
which is where you expect your service to be hosted that is public facing.If you are running a load balancer, it is the public side of that load balancer.If its a single server, it is the public endpoint.If you are running it through ngrok on your local machine it is the ngrok url, not localhost.
The reason for this is that the SSO providers expect an ssl termination to be present.Complete Environment Configuration
We should have these values in our.env
now:2
Run Statesman
Use the docker-compose.yml in examples:Place your
.env
in the same directory.Starting the Service
Run docker-compose up:3
Verify Statesman is running
You can verify statesman is running with:If all goes well you will see:
Configure Taco CLI
1
Install Cli
The first thing you’ll want to do is visit our releases page here and check the latest taco/cli release. Right now it is v0.1.7For other architectures:Confirm Taco CLI is available with:
2
Configure CLI Environment Variables
For the best experience in your shell you can configure the following environment vars for the CLI:The env variable
On macOS/Linux:
OPENTACO_SERVER
is the address of your server which we’ll get to setting up later.Create Your First Unit
Now that you have OpenTaco running and authentication configured, let’s walk through a complete example from creating a unit to running Terraform operations.1
Authenticate Both Systems
First, complete both authentication flows:
2
Create a Unit
Create a new unit to hold your Terraform state:Verify the unit was created:
3
Create a Terraform Configuration
Create a new directory and Terraform configuration:Create a
main.tf
file with cloud block configuration:4
Initialize Terraform
Initialize the Terraform project with the cloud backend:You should see output similar to:
5
Plan your changes
Run a Terraform plan to see what will be created:This will:
- Connect to OpenTaco using your stored credentials
- Create or use the “demo-project” workspace
- Show you the planned changes
6
Apply your configuration
Apply the Terraform configuration:Type
yes
when prompted. This will:- Create the random string resource
- Create a local file with the output
- Store the state remotely in OpenTaco
- Display the outputs
7
Verify state management
Check that your state is being managed by OpenTaco:You can also check your local directory:
8
Make changes and update
Edit your Plan and apply the changes:
main.tf
to add another resource:9
Explore unit management
Try some unit management operations:
10
cleanup
When you’re done experimenting:
Advanced Cloud Block Options
Multiple workspaces with tags:Troubleshooting
Troubleshooting Authentication
Re-authenticate if needed:- If
taco unit ls
fails: Your taco CLI authentication may have expired, runtaco login
- If
terraform init/plan
fails: Your terraform authentication may have expired, runterraform login
again - Both credentials are independent - one expiring doesn’t affect the other
Next Steps
Now you can:- Set up RBAC to control who can access different units
- Create multiple workspaces for different environments
- Use the S3-compatible API for advanced integrations
- Set up CI/CD pipelines using the cloud block
- Explore dependency management between units