{"id":18940726,"url":"https://github.com/aws-cloudformation/cloudformation-pkl","last_synced_at":"2025-08-30T20:13:40.978Z","repository":{"id":239206823,"uuid":"787605697","full_name":"aws-cloudformation/cloudformation-pkl","owner":"aws-cloudformation","description":null,"archived":false,"fork":false,"pushed_at":"2025-01-11T00:09:39.000Z","size":1488,"stargazers_count":20,"open_issues_count":5,"forks_count":3,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-07-01T14:07:32.427Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Pkl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aws-cloudformation.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2024-04-16T20:57:29.000Z","updated_at":"2025-04-25T22:00:39.000Z","dependencies_parsed_at":"2024-12-18T00:19:15.707Z","dependency_job_id":"6a9453ef-0654-4e7e-908b-d3a508347493","html_url":"https://github.com/aws-cloudformation/cloudformation-pkl","commit_stats":null,"previous_names":["aws-cloudformation/cloudformation-pkl"],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/aws-cloudformation/cloudformation-pkl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aws-cloudformation%2Fcloudformation-pkl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aws-cloudformation%2Fcloudformation-pkl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aws-cloudformation%2Fcloudformation-pkl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aws-cloudformation%2Fcloudformation-pkl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aws-cloudformation","download_url":"https://codeload.github.com/aws-cloudformation/cloudformation-pkl/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aws-cloudformation%2Fcloudformation-pkl/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272900161,"owners_count":25012034,"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","status":"online","status_checked_at":"2025-08-30T02:00:09.474Z","response_time":77,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-11-08T12:23:54.823Z","updated_at":"2025-08-30T20:13:40.953Z","avatar_url":"https://github.com/aws-cloudformation.png","language":"Pkl","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cloudformation-pkl\n\nPkl is a configuration language created by Apple (https://pkl-lang.org/index.html). \nIt is capable of serializing to other formats like YAML, so it's possible to\nwrite a CloudFormation template with pkl. This repository hosts the `cloudformation.pkl`\npackage that can be imported into your projects to provide a type-safe authoring experience.\nThe package also has a set of high level patterns that you adapt for your own needs.\n\nThe following is a basic example of a pkl CloudFormation template.\n\n```pkl\nAWSTemplateFormatVersion: String = \"2010-09-09\"\nDescription = \"My template\"\nParameters {\n    [\"Name\"] {\n        [\"Type\"] = \"String\"\n    }\n}\nResources {\n    [\"MyBucket\"] {\n        [\"Type\"] = \"AWS::S3::Bucket\"\n        [\"Properties\"] {\n            [\"BucketName\"] {\n                [\"Ref\"] = \"Name\"\n            }\n        }\n    }\n}\n```\n\nRunning `pkl eval -f yaml` on this file results in the following:\n\n```yaml\nAWSTemplateFormatVersion: 2010-09-09\nDescription: My template\nParameters:\n  Name:\n    Type: String\nResources:\n  MyBucket:\n    Type: AWS::S3::Bucket\n    Properties:\n      BucketName:\n        Ref: Name\n```\n\n## CloudFormation package with a type for each AWS resource\n\nHere's an example of a file you could write using modules in the `cloudformation.pkl` package:\n\n```pkl\namends \"@cfn/template.pkl\"\nimport \"@cfn/cloudformation.pkl\" as cfn\nimport \"@cfn/aws/s3/bucket.pkl\" as bucket\n\nDescription = \"Create a bucket\"\n\nMetadata { \n    [\"Foo\"] = \"bar\"\n}\n\nParameters {\n    [\"Name\"] {\n        Type = \"String\"\n        Default = \"baz\"\n    }\n}\n\nResources {\n    [\"TypedBucket\"] = new bucket.Bucket {\n        BucketName = cfn.Ref(\"Name\")\n    }\n}\n```\n\nNote that the package alias `@cfn` is enabled by creating a `PklProject` file that looks like this:\n\n```pkl\namends \"pkl:Project\"\n\ndependencies {\n    [\"cfn\"] {\n        uri = \"package://pkg.pkl-lang.org/github.com/aws-cloudformation/cloudformation-pkl/cloudformation@0.1.5\"\n    }\n}\n```\n\nIn the directory where you create `PklProject`, run `pkl project resolve`, which will auto-generate the `PklProject.deps.json` file. Then you can run `pkl eval my-template.pkl -f yaml` and the `@cfn` package will be downloaded in order to generate the output.\n\n## Patterns\n\nIt's possible to build higher level patterns in Pkl. In the following example,\nwe are building a VPC defined in `patterns/vpc.pkl`.\n\n```pkl\namends \"@cfn/template.pkl\"\nimport \"@cfn/cloudformation.pkl\" as cfn\nimport \"@cfn/patterns/vpc.pkl\"\n\nlocal pub1 = new vpc.Subnet {\n    LogicalId = \"Pub1\"\n    IsPublic = true\n    Az = cfn.Select(0, cfn.GetAZs(\"us-east-1\")) \n    Cidr = \"10.0.0.0/18\"\n}\n\nlocal pub2 = new vpc.Subnet {\n    LogicalId = \"Pub2\"\n    IsPublic = true\n    Az = cfn.Select(1, cfn.GetAZs(\"us-east-1\")) \n    Cidr = \"10.0.64.0/18\"\n}\n\nlocal priv1 = new vpc.Subnet {\n    LogicalId = \"Priv1\"\n    IsPublic = false\n    Az = cfn.Select(0, cfn.GetAZs(\"us-east-1\")) \n    Cidr = \"10.0.128.0/18\"\n    PublicNATGateway = pub1.natGateway\n}\n\nlocal priv2 = new vpc.Subnet {\n    LogicalId = \"Priv2\"\n    IsPublic = false\n    Az = cfn.Select(1, cfn.GetAZs(\"us-east-1\")) \n    Cidr = \"10.0.192.0/18\"\n    PublicNATGateway = pub2.natGateway\n}\n\nlocal myvpc = new vpc {\n    LogicalId = \"MyVPC\"\n    Subnets {\n        pub1\n        priv1\n        pub2\n        priv2\n    }\n}\n\nResources {\n    // Create the VPC\n    ...myvpc.Resources\n\n    // Create other resources inside the VPC...\n}\n\nOutputs {\n    ...myvpc.Outputs\n}\n\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faws-cloudformation%2Fcloudformation-pkl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faws-cloudformation%2Fcloudformation-pkl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faws-cloudformation%2Fcloudformation-pkl/lists"}