{"id":15403430,"url":"https://github.com/mbj/stratosphere","last_synced_at":"2025-05-15T16:09:08.540Z","repository":{"id":42053886,"uuid":"54836618","full_name":"mbj/stratosphere","owner":"mbj","description":"Haskell EDSL and type-checker for AWS CloudFormation templates","archived":false,"fork":false,"pushed_at":"2024-12-11T22:54:10.000Z","size":18090,"stargazers_count":163,"open_issues_count":3,"forks_count":19,"subscribers_count":24,"default_branch":"main","last_synced_at":"2025-05-09T02:12:34.959Z","etag":null,"topics":["aws","cloudformation","haskell"],"latest_commit_sha":null,"homepage":null,"language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mbj.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","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},"funding":{"github":"mbj"}},"created_at":"2016-03-27T16:06:24.000Z","updated_at":"2024-12-20T03:03:37.000Z","dependencies_parsed_at":"2025-01-04T08:20:01.339Z","dependency_job_id":null,"html_url":"https://github.com/mbj/stratosphere","commit_stats":{"total_commits":556,"total_committers":12,"mean_commits":"46.333333333333336","dds":"0.30035971223021585","last_synced_commit":"ba95ad290a418332bf25fcabee42e7fb06d19c7f"},"previous_names":[],"tags_count":91,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbj%2Fstratosphere","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbj%2Fstratosphere/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbj%2Fstratosphere/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbj%2Fstratosphere/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mbj","download_url":"https://codeload.github.com/mbj/stratosphere/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254374483,"owners_count":22060612,"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","cloudformation","haskell"],"created_at":"2024-10-01T16:08:31.299Z","updated_at":"2025-05-15T16:09:03.532Z","avatar_url":"https://github.com/mbj.png","language":"Haskell","funding_links":["https://github.com/sponsors/mbj"],"categories":[],"sub_categories":[],"readme":"# Stratosphere: AWS CloudFormation in Haskell\n\n[![CI](https://github.com/mbj/stratosphere/actions/workflows/ci.yaml/badge.svg)](https://github.com/mbj/stratosphere/actions/workflows/ci.yaml)\n[![sponsors](https://img.shields.io/github/sponsors/mbj)](https://github.com/sponsors/mbj)\n[![hackage](https://img.shields.io/hackage/v/stratosphere)](https://hackage.haskell.org/package/stratosphere)\n\nAWS CloudFormation is a system that provisions and updates Amazon Web Services\n(AWS) resources based on declarative templates. Common criticisms of\nCloudFormation include the use of JSON as the template language and limited\nerror-checking, often only available in the form of run-time errors and stack\nrollbacks. By wrapping templates in Haskell, it is possible to easily construct\nthem and help ensure correctness.\n\nThe goals of stratosphere are to:\n\n* Build a Haskell EDSL to specify CloudFormation templates. Since it is\n  embedded in Haskell, it is type-checked and generally much easier to work\n  with than raw JSON/YAML.\n* Have a simple checking/linting system outside of the types that can find\n  common errors in templates.\n\n## Funding / Sponsoring\n\nThis library is maintained by [mbj](https://github.com/sponsors/mbj) and any pledge is greatly apprechiated.\n\n## Example\n\n**THIS SHOWS UNRELEASED API, to use it use a git source while 1.0 is under development** [old readme](https://github.com/mbj/stratosphere/tree/v0.60.0#readme).\n\nHere is an example of a `Template` that creates an EC2 instance, along with the\nJSON output:\n\n```haskell\nmodule Main where\n\nimport Stratosphere\n\nimport qualified Data.ByteString.Lazy.Char8 as B\n\nmain :: IO ()\nmain = B.putStrLn $ encodeTemplate template\n\ntemplate :: Template\ntemplate\n  = mkTemplate [ec2Instance]\n  \u0026 set @\"Description\" \"EC2 Example template\"\n  \u0026 set @\"Parameters\"  [keyName]\n\nkeyName :: Parameter\nkeyName\n  = mkParameter \"KeyName\" \"AWS::EC2::KeyPair::KeyName\"\n  \u0026 set @\"Description\"           \"Name of an existing EC2 KeyPair to enable SSH access to the instance\"\n  \u0026 set @\"ConstraintDescription\" \"Must be the name of an existing EC2 KeyPair.\"\n\nec2Instance :: Resource\nec2Instance\n  = set @\"DeletionPolicy\" Retain\n  . resource \"EC2Instance\"\n  $ EC2.mkInstance\n  \u0026 set @\"ImageId\" \"ami-22111148\"\n  \u0026 set @\"KeyName\" (toRef keyName)\n```\n\n```json\n{\n  \"Description\": \"EC2 Example template\",\n  \"Parameters\": {\n    \"KeyName\": {\n      \"Description\": \"Name of an existing EC2 KeyPair to enable SSH access to the instance\",\n      \"ConstraintDescription\": \"Must be the name of an existing EC2 KeyPair.\",\n      \"Type\": \"AWS::EC2::KeyPair::KeyName\"\n    }\n  },\n  \"Resources\": {\n    \"EC2Instance\": {\n      \"DeletionPolicy\": \"Retain\",\n      \"Properties\": {\n        \"ImageId\": \"ami-22111148\",\n        \"KeyName\": {\n          \"Ref\": \"KeyName\"\n        }\n      },\n      \"Type\": \"AWS::EC2::Instance\"\n    }\n  }\n}\n```\n\nPlease see the [examples](examples/Stratosphere/Examples) directory for more in-depth\nexamples (including this one). The `stratosphere-example` package produces a same named\nbinary with a minimal CLI for exploration.\n\nIts encouraged to use it as a playground while exploring this library.\n\n```\nSTACK_YAML=stack-9.2.yaml stack build --copy-bins --test stratosphere-examples\n```\n\n## Value Types\n\nCloudFormation resource parameters can be literals (strings, integers, etc),\nreferences to another resource or a Parameter, or the result of some function\ncall. We encapsulate all of these possibilities in the `Value a` type.\n\nIt is recommend using the `OverloadedStrings` and `OverloadedLists` extensions to reduce\nthe number of `Literal`s that have to be written.\n\n## Optional and required properties\n\nAlmost every CloudFormation resource has a handful of required arguments, and\nmany more optional arguments. Each resource is represented as a record type\nwith optional arguments wrapped in `Maybe`. Each resource also comes with a\nbuilder that accepts required resource properties as arguments. This allows\nthe user to succinctly specify the resource properties they actually use\nwithout adding too much noise to their code.\n\nTo specify optional arguments, stratosphere exposes the `set` function that takes\nthe type level symbol of the property to set and the value as argument. Its recommended to use the\n`\u0026` function to chain these updates. See examples.\n\n## Auto-generation\n\nAll of the resources and resource properties are auto-generated from\na\n[JSON schema file](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-resource-specification.html) and\nare placed in `services/`. The `generator/` directory contains the auto-generator package `stratosphere-generator`\ncode and the JSON model file. The `services/` directory is included in git so\nthe build process is simplified. To build `stratosphere-generator` from scratch and\nthen build all of `stratosphere`, build the `stratosphere-generator` package via `stack` and execute the `stratosphere-generator` binary from the project root.\n\n## Contributing\n\nFeel free to raise any issues, or even just make suggestions, by filing a Github issue.\n\n## Future Work\n\n* Implement basic checker for things like undefined Refs and duplicate field\n  names. This stuff would be too unwieldy to do in types, and performing a\n  checking pass over a template should be pretty straightforward.\n\n## Development Build\n\n```\n# warning takes a while ;)\nSTACK_YAML=stack-9.2.yaml stack build --copy-bins --test stratosphere-generator\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmbj%2Fstratosphere","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmbj%2Fstratosphere","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmbj%2Fstratosphere/lists"}