Back to Blog
Terragen spherical5/21/2023 Level 2 - infra type - the type of infra being generated, eg VPC, EC2, S3 etc.Level 1 - shared|app - whether the namespace refers to shared infrastructure or app specific infra.Terragen expects namespaces to be three levels deep, as follows: config -cn config -cfg job -resolve We see Terragen has built our namespace exactly as we defined it: shared: aws/shared/vpcs/simple_vpc.yamlĪnd when we resolve our config with the command terragen -cd. So in our example configs you'll find the following file. As so: defaults:īreaking down the structure we see the following 3 elements: - aws/shared/vpcs _vpc simple_vpc The defaults section of config.yaml allows you to specify where the config file is located, and the namespace for the generated yaml. We'll dig into these files in more detail config.yaml defaults Resulting in a structure as follows: apps shared - Config for shared infrastructure like VPCs and Databases.base - These are base configs where we can "sub-class" in either apps or shared config files to override specific elements as needed.apps - App specific config files are here.It will also contain a set of sub-directories containing the specification of your config. You can run them by just referencing their names, eg: terragen -config-dir. However, you can have multiple files here for different projects/pieces of infrastructure if needed. The config directory must contain at least one config file, by default this is expected to be named config.yaml. modules containing the Terraform modules you want to apply.config containing the Terragen config which will be used to generate your tfvars files.If you've followed the Getting Started guide you should have your Terragen Workspace containing two directories: If you haven't already please clone the example configs project so you can follow along with the examples below: git clone This page will explain how this can be controlled. tfvars file as per the configuration you specify in the Terragen config. Terragen will copy your Terraform Modules, and generate you a. This means you can bring your own Terraform modules and use them with Terragen with almost zero changes. tfvars file that will be injected into your module and then parsed by Terraform. Bring Your Own Terraform Modulesįundamentally Terragen is generating a Terraform. For a fuller understanding of configuring Terragen I recommend you take a look at the Hydra Project Documentation here. Terragen uses the Hydra Project to manage and parse configuration. This page defines what these items are and shows how you can extend it for your own projects. As long as your config meets these criteria and your config correctly resolves then Terragen should parse it. Terragen's config structure is flexible with the exception a few mandatory items. Terragen Configuration Terragen Config Structure
0 Comments
Read More
Leave a Reply. |