User Guides

Dynamic Resource Names


Sometimes you'll want to give your resources a name that is specific to the project or environment that they are in. This is especially useful for resources that require globally unique names such as GCS and S3 buckets. To do this you can use the project and environment attributes of the launchflow module.

1
import launchflow as lf
2
3
gcs_bucket = lf.gcp.GCSBucket(
4
name=f"my-bucket-{lf.project}-{lf.environment}"
5
)
6
s3_bucket = lf.aws.S3Bucket(
7
name=f"my-bucket-{lf.project}-{lf.environment}"
8
)

Now when you run lf create --project=my-project --environment=dev the name of the bucket will be my-bucket-my-project-dev. This will also work for any of our other commands that parse resources from your code such as destroy and clean.

Previous
Secrets