{"id":13442927,"url":"https://github.com/mujx/dhall-terraform","last_synced_at":"2025-03-20T15:31:35.505Z","repository":{"id":50621266,"uuid":"220274712","full_name":"mujx/dhall-terraform","owner":"mujx","description":"Generate dhall records from terraform resouces, data_sources \u0026 providers","archived":false,"fork":false,"pushed_at":"2020-04-20T18:04:17.000Z","size":823,"stargazers_count":56,"open_issues_count":0,"forks_count":13,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-28T06:00:11.746Z","etag":null,"topics":["aws","configuration","dhall","terraform","terraform-aws"],"latest_commit_sha":null,"homepage":"","language":"Dhall","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mujx.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-11-07T15:57:40.000Z","updated_at":"2024-10-05T01:04:12.000Z","dependencies_parsed_at":"2022-09-24T16:13:12.118Z","dependency_job_id":null,"html_url":"https://github.com/mujx/dhall-terraform","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mujx%2Fdhall-terraform","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mujx%2Fdhall-terraform/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mujx%2Fdhall-terraform/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mujx%2Fdhall-terraform/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mujx","download_url":"https://codeload.github.com/mujx/dhall-terraform/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244640064,"owners_count":20485978,"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":["aws","configuration","dhall","terraform","terraform-aws"],"created_at":"2024-07-31T03:01:53.410Z","updated_at":"2025-03-20T15:31:34.980Z","avatar_url":"https://github.com/mujx.png","language":"Dhall","funding_links":[],"categories":["Dhall","aws"],"sub_categories":[],"readme":"# dhall-terraform\n\n[![CircleCI](https://circleci.com/gh/mujx/dhall-terraform.svg?style=svg)](https://circleci.com/gh/mujx/dhall-terraform)\n[![License: Unlicense](https://img.shields.io/badge/license-Unlicense-blue.svg)](http://unlicense.org/)\n\n`dhall-terraform` uses terraform's provider schema to generate Dhall types \u0026 defaults\nfor each `resource`, `data_source` \u0026 `provider` block. \n\nThis allows us to use Dhall to create cloud resources instead of HCL \u0026 avoid its\nlimitations.\n\n### Installation\n\nYou can use one of `cabal-install`, `stack` or `nix` to build and install the\nproject.\n\n### Usage\n\n- Use `dhall-terraform` to generate the types of your provider. \n  See [here](https://www.terraform.io/docs/commands/providers/schema.html) how\n  you can generate the provider's schema.\n- Write the resources in Dhall. Checkout the [examples](./examples).\n- Use `dhall-to-json` to generate terraform's [JSON syntax][terraform_json_syntax]\n- Continue with `terraform` operations as normal.\n\n### AWS example\n\nExample using the generated resources from the AWS provider.\n\n```dhall\nlet Prelude =\n      https://raw.githubusercontent.com/dhall-lang/dhall-lang/master/Prelude/package.dhall\n\n-- Get the correct type needed for Terraform's JSON syntax.\nlet jsonRes = λ(a : Type) → { mapKey : Text, mapValue : a }\n\n-- Create a JSON serialized resource given its name and type.\nlet mkRes =\n        λ(a : Type)\n      → λ(name : Text)\n      → λ(body : a)\n      → Prelude.JSON.keyValue a name body\n\n-- Import the necessary resources.\nlet AwsProvider =\n      https://raw.githubusercontent.com/mujx/dhall-terraform/99a96658642aef74f0b01c0da73f2c9a07171f52/lib/aws/provider/provider.dhall\n\nlet AwsS3Bucket =\n      https://raw.githubusercontent.com/mujx/dhall-terraform/99a96658642aef74f0b01c0da73f2c9a07171f52/lib/aws/resources/aws_s3_bucket.dhall\n\nlet defaultRegion = \"us-east-1\"\n\nlet Bucket = { region : Text, name : Text }\n\nlet buckets =\n        [ { region = defaultRegion, name = \"images\" }\n        , { region = defaultRegion, name = \"files\" }\n        ]\n      : List Bucket\n\nlet toBucketResource\n    : Bucket → jsonRes AwsS3Bucket.Type\n    =   λ(bkt : Bucket)\n      → mkRes\n          AwsS3Bucket.Type\n          bkt.name\n          AwsS3Bucket::{\n          , tags = Some [ { mapKey = \"content\", mapValue = bkt.name } ]\n          , region = Some defaultRegion\n          }\n\nlet awsProvider =\n      mkRes\n        AwsProvider.Type\n        \"aws\"\n        AwsProvider::{ region = defaultRegion, version = Some \"2.34.0\" }\n\nin  { provider = [ awsProvider ]\n    , resource =\n        { aws_s3_bucket =\n            Prelude.List.map\n              Bucket\n              (jsonRes AwsS3Bucket.Type)\n              toBucketResource\n              buckets\n        }\n    }\n```\n\n### Options\n\n```\ndhall-terraform :: v0.1.0\n\nUsage: dhall-terraform (-f|--schema-file SCHEMA) (-p|--provider-name PROVIDER)\n                       [-o|--output-dir OUT_DIR]\n  Generate Dhall types from Terraform resources\n\nAvailable options:\n  -h,--help                Show this help text\n  -f,--schema-file SCHEMA  Terraform provider's schema definitions\n  -p,--provider-name PROVIDER\n                           Which provider's resources will be generated\n  -o,--output-dir OUT_DIR  The directory to store the generated\n                           files (default: \"./lib\")\n```\n\n[terraform_json_syntax]: https://www.terraform.io/docs/configuration/syntax-json.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmujx%2Fdhall-terraform","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmujx%2Fdhall-terraform","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmujx%2Fdhall-terraform/lists"}