10 days ago
Hey folks! We’ve released an experimental first version of Railway Infrastructure as Code.
You can now define, import, preview, and apply project configuration from a single .railway/railway.ts file.
This is meant to manage project-level configuration like services, databases, buckets, domains, variables, replicas, and groups from code.
Docs are here: https://docs.railway.com/infrastructure-as-code. Only TypeScript is supported for now, which requires the Railway TypeScript SDK to be installed as a dependency, but we plan to add support to other languages as well.
This is intentionally experimental, so please expect rough edges. We’re especially interested in feedback on the authoring experience, imported config quality, plan/apply output, and anything that feels confusing or unsafe.
You'll need to upgrade to the latest version of the CLI (5.2.0). If you try it, please share what worked, what didn’t, and what would make it easier to trust in real projects.
0 Threads mention this feature
8 Replies
6 days ago
I am finding the errors output by "railway config apply" to be a bit mysterious, for example, I had the wrong region setup for a bucket being created which causes the tool to error but the message is just "Invalid RailwayChangeSet patch" with no further information, it would be good to have some --debug option to see whats actually gone wrong
xeofd
I am finding the errors output by "railway config apply" to be a bit mysterious, for example, I had the wrong region setup for a bucket being created which causes the tool to error but the message is just "Invalid RailwayChangeSet patch" with no further information, it would be good to have some --debug option to see whats actually gone wrong
6 days ago
It would also be good to be able to track/set the region on databases through IaC, for example, if I setup a new db through IaC it automatically provisions in one of the us regions, when I would prefer it to be provisioned within the EU
6 days ago
It also seems that when you run a "railway config pull" it doesn't pull in any of the environment variables that were set manually in railway UI. I would expect when you run a pull it should pull in the variable names and at least set them to "preserve()" as the docs suggest you do when writing it yourself.
xeofd
It would also be good to be able to track/set the region on databases through IaC, for example, if I setup a new db through IaC it automatically provisions in one of the us regions, when I would prefer it to be provisioned within the EU
6 days ago
another note on regions, having setup a bucket manually through the UI and setting it to EU, when I then pull that config down, the region its is set to is "ams", I cant find that in the documentation as a region reference, so im not sure if the documentation is out of date? (https://docs.railway.com/deployments/regions). It would be good if the options for regions could be typed, i.e {region: "ams", "us-east1", "asia-southeast1", ...etc} to remove any confusion
5 days ago
This is not IaC, its Railway-as-Code. Please adopt terraform provider properly.
5 days ago
There seems to be a bug with adding buckets to groups, if you create a new bucket and add it to a group the apply command will fail with another obscure message, I see the same behavior for existing buckets being added to groups, or if I add a bucket to a group in the UI, pull the config and then run an apply, it seems to want to remove it from the group according to the plan step and then during apply it fails
3 days ago
How to attach a volume to a database service? Let's say I will need 500 GB of disk space available.
Also, how to attach a volume to a regular service? Couldn't find the right examples so far.
3 days ago
I couldn't apply the config changes due to the error below:
❯ railway config plan
✗ Could not read Railway configuration
Railway configuration
Using .railway/railway.ts
Error error: Cannot find module '/Users/tko/dev/github/namehash/ensnode/node_modules/.pnpm/railway@3.1.2/node_modules/railway/dist/iac/index.cjs?namespace=1781194186859' imported from /Users/tko/dev/github/namehash/ensnode/.railway/railway.ts?t=1781194186843&namespace=1781194186859
IaC runner returned diagnostics
I've checked the /Users/tko/dev/github/namehash/ensnode/node_modules/.pnpm/railway@3.1.2/node_modules/railway/dist/iac/index.cjs path and I can see the file exists.
The .railway/railway.ts file defines a simple auto-generated setup:
import { defineRailway, project, service } from "railway/iac";
export default defineRailway(() => {
const web = service("web", {
// Add build/start commands when Railway cannot infer them.
// build: "pnpm install --frozen-lockfile && pnpm build",
// start: "pnpm start",
env: {
NODE_ENV: "production",
},
});
return project("ensnode", {
resources: [web],
});
});

