{"id":16208439,"url":"https://github.com/g-rath/terra","last_synced_at":"2025-04-07T20:29:34.590Z","repository":{"id":104158589,"uuid":"216486627","full_name":"G-Rath/terra","owner":"G-Rath","description":"Terraform parser, generator, and formatter","archived":false,"fork":false,"pushed_at":"2021-02-20T19:05:12.000Z","size":1808,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-13T22:16:26.444Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/G-Rath.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-10-21T05:44:06.000Z","updated_at":"2021-04-28T18:39:52.000Z","dependencies_parsed_at":null,"dependency_job_id":"d7045742-26d4-4a99-a60a-3ac2dc7a575d","html_url":"https://github.com/G-Rath/terra","commit_stats":{"total_commits":295,"total_committers":1,"mean_commits":295.0,"dds":0.0,"last_synced_commit":"74e6fc5b50c8fe34ce14f6429bb2f2d8d460cbbb"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/G-Rath%2Fterra","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/G-Rath%2Fterra/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/G-Rath%2Fterra/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/G-Rath%2Fterra/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/G-Rath","download_url":"https://codeload.github.com/G-Rath/terra/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247724704,"owners_count":20985560,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-10T10:16:57.070Z","updated_at":"2025-04-07T20:29:34.568Z","avatar_url":"https://github.com/G-Rath.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# terra\n\nCommand-line tool for generating and importing assets into Terraform.\n\n## Running locally from project\n\nCurrently oclif has a number of hard codings that force you to recompile the cli\nevery time you want to test it end-to-end locally.\n\nWhile this isn't a big deal if you're doing final stage manual testing, it can\nbe very slow and painful if you're doing tweaking, and so want to run the cli\nmultiple times to test out small changes.\n\nTo have `oclif` use the `src` files via `ts-node`, you must change the value of\n`.oclif.commands` in `package.json` to the following:\n\n    ./lib/src/commands\n\nThis is because the root `tsconfig.json` has it's `rootDir` set to `.`, in order\nto ensure native IDE support out of the box.\n\nAlternatively, you can create a symlink named `lib` to `src`:\n\n    ln -s src lib\n\nMeanwhile, `oclif` is hardcoded to look for a root level `tsconfig.json`, and\nprovides no way to point it at `tsconfig.build.json`.\n\nIn addition, it also hardcoded the `require`ing of `typescript`, providing no\nway to have it use `ttypescript`, and so cannot use `ts-transformer-paths`.\n\nAs such, `tsconfig-paths` must be register for `paths` to be properly resolved:\n\n     node -r tsconfig-paths/register bin/terra\n\nFor convenience this has been added as a `script` in `package.json`:\n\n    npm run cli\n\n## Layout\n\n### Commands\n\nCommands are named functions that the CLI can perform.\n\nThey handle parsing the user input, and performing actions based on that input.\n\nTypically, the Terraform porting commands defer to the appropriate 'nado, and\nthen print the resulting AST to file.\n\n### 'nados\n\n'nados (from Tornado) are a form of orchestration that is easier to spell.\nThey're called 'nados because they \"sweep up\" whole slices of infrastructure.\n\nThey handle orchestrating the collecting of details, and having those details\nbuilt into Terraform AST that can then be printed \u0026 written to disk as a valid\nTerraform file.\n\nThe actual logic of these steps is implemented in specific functions, detailed\nbelow. 'nados return a collection of complete Terraform top-level blocks.\n\nSince typically the infrastructure being ported into Terraform via Terra is\neither top- or middle- level, most 'nados support a `greedy` argument that when\n`true` has them look for related supporting infrastructure.\n\nFor example, the 'nado for AWS Route53 Hosted Zones will also sweep in the\nrecords of that zone when `greedy` is `true`.\n\n### Collectors\n\nCollectors collect all the configuration details required to represent the\ntargeted infrastructure in Terraform.\n\nThey handle making the API calls required to get details, and mapping them to\nthe expected structure.\n\n### Builders\n\nBuilders use the collected configuration details to build AST nodes that\nrepresent how to structure the infrastructure in Terraform.\n\nThey handle shaping the infrastructure details where required by performing\nactions such as:\n\n- wrapping native strings in double quotes\n- sanitising names so they're Terraform safe,\n- normalising values so they're consistent\n\n### Printers\n\nPrinters convert Terraform AST nodes into valid Terraform code as raw multiline\nstring literals.\n\n### TerraParse\n\nTerra has its own Terraform parser, referred to as \"TerraParse\" in docs to help\ndifferentiate it from the native parser used by Terraform proper.\n\nCompared to the native Terraform parser, TerraParse is much looser, parsing\nnumerous syntax errors as semantic errors instead.\n\nIt does this by only erroring when it's unable to determine what it's parsing,\neither because it does not recognise the syntax _or_ because the syntax is too\nambiguous for the parser to be able to remain lossless.\n\nThe logic behind the second reason for erroring is what makes TerraParse less\nstrict than Terraform, as it inversely means the parser can convert the majority\nof would-be syntax errors into semantic ones.\n\nFor example, Terraform only accepts double quotes, and so will error on single\nquotes. In comparision, TerraParse will parse such quotes as valid syntax.\n\nHowever, both Terraform native \u0026 TerraParse will error on an unclosed quote, as\nthat is a _hard_ syntax error. In TerraParse' case, it will error because it's\nnot possible to confidently determine where the string should be closed without\nmaking assumptions that could charge the parsing of the rest of the file.\n\nSuch syntax-turned-semantic errors can be thought of as \"misused syntax\".\n\nExamples of syntax errors that are considered semantic by the parser include:\n\n- newlines before and after the equals in block arguments\n- newlines before the opening brace of a block body\n- using single quotes instead of double quotes\n- missing comma separator in list expressions\n\nGenerally most forms of syntax-turned-semantic errors involve newlines.\n\nOverall, TerraParse attempts to parse \"lossless-ly\", with being able to print\nthe parsed file exactly as it was read.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fg-rath%2Fterra","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fg-rath%2Fterra","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fg-rath%2Fterra/lists"}