{"id":13751863,"url":"https://github.com/Bayer-Group/cloudformation-template-generator","last_synced_at":"2025-05-09T18:32:33.899Z","repository":{"id":34510782,"uuid":"38452210","full_name":"Bayer-Group/cloudformation-template-generator","owner":"Bayer-Group","description":"A type-safe Scala DSL for generating CloudFormation templates","archived":false,"fork":false,"pushed_at":"2022-07-29T11:32:04.000Z","size":13338,"stargazers_count":211,"open_issues_count":18,"forks_count":71,"subscribers_count":35,"default_branch":"master","last_synced_at":"2024-10-01T09:14:40.105Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Bayer-Group.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-02T19:17:36.000Z","updated_at":"2023-07-31T19:08:13.000Z","dependencies_parsed_at":"2022-09-10T21:01:54.824Z","dependency_job_id":null,"html_url":"https://github.com/Bayer-Group/cloudformation-template-generator","commit_stats":null,"previous_names":[],"tags_count":43,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bayer-Group%2Fcloudformation-template-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bayer-Group%2Fcloudformation-template-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bayer-Group%2Fcloudformation-template-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bayer-Group%2Fcloudformation-template-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Bayer-Group","download_url":"https://codeload.github.com/Bayer-Group/cloudformation-template-generator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224876976,"owners_count":17384699,"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-08-03T09:00:56.149Z","updated_at":"2024-11-16T04:31:49.539Z","avatar_url":"https://github.com/Bayer-Group.png","language":"Scala","funding_links":[],"categories":["Ranked by starred repositories"],"sub_categories":[],"readme":"# CloudFormation Template Generator\n\n[![Build Status](https://travis-ci.com/bayer-group/cloudformation-template-generator.svg?branch=master)](https://travis-ci.com/bayer-group/cloudformation-template-generator) [![Coverage Status](https://coveralls.io/repos/github/Bayer-Group/cloudformation-template-generator/badge.svg?branch=master)](https://coveralls.io/github/Bayer-Group/cloudformation-template-generator?branch=master)\n\nScala DSL to create AWS CloudFormation (CFN) templates. The library\nallows for easier creation of the AWS CloudFormation JSON by writing Scala code\nto describe the AWS resources. Lets say we have a handful of CFN templates we\nwant to maintain, and all of those templates use the same AMI. Instead of\ncopying that information into all the templates, lets create an AMI component\ninstead, and then load it into the actual templates.\n\n**_Why not just write JSON?_**  Because, who in their right mind would want to\nwrite all AWS resources in JSON?\n\n## Documentation\n\nSee the intro [blog\npost](http://engineering.monsanto.com/2015/07/10/cloudformation-template-generator/).\n\nThis library was previously hosted on BinTray, however, with the sunsetting of this service, it is now\nhosted on Maven Central.  You no longer need to add a resolver to pull it in.\n\nThe library was previously published under the `com.monsanto.arch` group ID.  With Bayer's acquisition of Monsanto\nlong ago completed, we have renamed the group ID to `com.bayer` starting with version v3.10.3.  **Note that the\nactual Java/SBT packages themselves still use com.monsanto, as that's a more significant breaking change.  Only the\ngroup ID in SBT/Maven has changed.**\n\n```scala\nlibraryDependencies ++= Seq (\n  \"com.bayer\" %% \"cloud-formation-template-generator\" % \"3.10.3\"\n).map(_.force())\n```\n\nto your `build.sbt`.\n\nSee the\n[Scaladoc](http://monsantoco.github.io/cloudformation-template-generator/) for\ndetailed documentation and examples.\n\nSee the [Change Log](CHANGELOG.md) for information on new, changed,\nand deprecated featured.\n\n**Note**: we are no longer using the git-flow develop/master branch paradigm.\nPlease just branch off master and submit your PRs against it.\n\n### Components\n\nCreate a Template instance of resources and check out VPCWriter to help write\nit to a file.\n\nTo use the fancier parts of the routing DSL, be sure to import\n`TransportProtocol._`.\n\n### Misc Features\n\nNEW since the blog post, say you have a topology with subnets across multiple\nAZ's and you want to specify an autoscaling group that spans them, using our\nfancy Builders methods. Well this is cross-cutting, so its not strictly nested,\nso you can use an evil evil var, or now you can use our\n`Template.lookupResource[R \u003c: Resource[R]](name: String)` method on previous\ntemplate parts to extract resources by name. Note this will produce a\ngeneration-time error if you lookup something that does not exist or has the\nwrong type (unfortunately not a generation-time compiler error as most of our\nother features):\n\n```scala\ndescribe(\"Template Lookup\") {\n  it(\"Should lookup resources with the correct type\") {\n\n    val expected = `AWS::EC2::VPC`(\n      name = \"TestVPC\",\n      CidrBlock = CidrBlock(0,0,0,0,0),\n      Tags = Seq.empty[AmazonTag]\n    )\n    val template = Template.fromResource(expected)\n\n    assert(expected === template.lookupResource[`AWS::EC2::VPC`](\"TestVPC\"))\n}\n```\n\n### Currently supported AWS resource types\n\n- AWS::ApiGateway::Account\n- AWS::ApiGateway::ApiKey\n- AWS::ApiGateway::Authorizer\n- AWS::ApiGateway::BasePathMapping\n- AWS::ApiGateway::ClientCertificate\n- AWS::ApiGateway::Deployment\n- AWS::ApiGateway::Method\n- AWS::ApiGateway::Model\n- AWS::ApiGateway::Resource\n- AWS::ApiGateway::RestApi\n- AWS::ApiGateway::Stage\n- AWS::ApiGateway::UsagePlan\n- AWS::ApiGateway::UsagePlanKey\n- AWS::ApplicationAutoScaling::ScalableTarget\n- AWS::ApplicationAutoScaling::ScalingPolicy\n- AWS::AutoScaling::AutoScalingGroup\n- AWS::AutoScaling::LaunchConfiguration\n- AWS::AutoScaling::ScalingPolicy\n- AWS::Batch::ComputeEnvironment\n- AWS::Batch::JobDefinition\n- AWS::Batch::JobQueue\n- AWS::CloudFormation::CustomResource\n- AWS::CloudFormation::Stack\n- AWS::CloudFormation::WaitCondition\n- AWS::CloudFormation::WaitConditionHandle\n- AWS::CloudFront::Distribution\n- AWS::CloudTrail::Trail\n- AWS::CloudWatch::Alarm::ComparisonOperator\n- AWS::CloudWatch::Alarm::Dimension\n- AWS::CloudWatch::Alarm::Namespace\n- AWS::CloudWatch::Alarm::Statistic\n- AWS::CloudWatch::Alarm::Unit\n- AWS::CloudWatch::Alarm\n- AWS::CodeBuild::Project\n- AWS::CodeCommit::Repository\n- AWS::CodePipeline::CustomActionType\n- AWS::CodePipeline::Pipeline\n- AWS::DataPipeline::Pipeline\n- AWS::DynamoDB::Table\n- AWS::EC2::CustomerGateway\n- AWS::EC2::EIP\n- AWS::EC2::EIPAssociation\n- AWS::EC2::Instance\n- AWS::EC2::InternetGateway\n- AWS::EC2::KeyPair::KeyName\n- AWS::EC2::NatGateway\n- AWS::EC2::NetworkAcl\n- AWS::EC2::NetworkAclEntry\n- AWS::EC2::Route\n- AWS::EC2::RouteTable\n- AWS::EC2::SecurityGroup\n- AWS::EC2::SecurityGroupEgress\n- AWS::EC2::SecurityGroupIngress\n- AWS::EC2::Subnet\n- AWS::EC2::SubnetNetworkAclAssociation\n- AWS::EC2::SubnetRouteTableAssociation\n- AWS::EC2::VPC\n- AWS::EC2::VPCEndpoint\n- AWS::EC2::VPCGatewayAttachment\n- AWS::EC2::VPCPeeringConnection\n- AWS::EC2::VPNConnection\n- AWS::EC2::VPNConnectionRoute\n- AWS::EC2::VPNGateway\n- AWS::EC2::Volume\n- AWS::EC2::VolumeAttachment\n- AWS::ECR::Repository\n- AWS::ECS::Cluster\n- AWS::ECS::Service\n- AWS::ECS::TaskDefinition\n- AWS::EFS::FileSystem\n- AWS::EFS::MountTarget\n- AWS::EKS::Cluster\n- AWS::EMR::Cluster\n- AWS::EMR::Step\n- AWS::ElastiCache::CacheCluster\n- AWS::ElastiCache::SubnetGroup\n- AWS::ElasticBeanstalk::Application\n- AWS::ElasticBeanstalk::ApplicationVersion\n- AWS::ElasticBeanstalk::ConfigurationTemplate\n- AWS::ElasticBeanstalk::Environment\n- AWS::ElasticLoadBalancing::LoadBalancer\n- AWS::ElasticLoadBalancingV2::Listener\n- AWS::ElasticLoadBalancingV2::ListenerRule\n- AWS::ElasticLoadBalancingV2::LoadBalancer\n- AWS::ElasticLoadBalancingV2::TargetGroup\n- AWS::Elasticsearch::Domain\n- AWS::Events::Rule\n- AWS::IAM::AccessKey\n- AWS::IAM::Group\n- AWS::IAM::InstanceProfile\n- AWS::IAM::ManagedPolicy\n- AWS::IAM::Policy\n- AWS::IAM::Role\n- AWS::IAM::User\n- AWS::KMS::Alias\n- AWS::KMS::Key\n- AWS::Kinesis::Stream\n- AWS::KinesisFirehose::DeliveryStream\n- AWS::Lambda::Alias\n- AWS::Lambda::EventSourceMapping\n- AWS::Lambda::Function\n- AWS::Lambda::Permission\n- AWS::Lambda::Version\n- AWS::Logs::Destination\n- AWS::Logs::LogGroup\n- AWS::Logs::LogStream\n- AWS::Logs::MetricFilter\n- AWS::Logs::SubscriptionFilter\n- AWS::RDS::DBInstance::Engine\n- AWS::RDS::DBInstance::LicenseModel\n- AWS::RDS::DBInstance::StorageType\n- AWS::RDS::DBInstance\n- AWS::RDS::DBParameterGroup\n- AWS::RDS::DBSecurityGroup\n- AWS::RDS::DBSubnetGroup\n- AWS::Redshift::Cluster\n- AWS::Redshift::ClusterParameterGroup (along with helper RedshiftClusterParameter type)\n- AWS::Redshift::ClusterSecurityGroup\n- AWS::Redshift::ClusterSecurityGroupIngress\n- AWS::Redshift::ClusterSubnetGroup\n- AWS::Route53::HostedZone\n- AWS::Route53::RecordSet\n- AWS::S3::Bucket\n- AWS::S3::BucketPolicy\n- AWS::SNS::Subscription\n- AWS::SNS::Topic\n- AWS::SNS::TopicPolicy\n- AWS::SQS::Queue\n- AWS::SQS::QueuePolicy\n- AWS::SSM::Association\n- AWS::SSM::Document\n- AWS::SSM::Parameter\n- AWS::SecretsManager::ResourcePolicy\n- AWS::SecretsManager::RotationSchedule\n- AWS::SecretsManager::Secret\n- AWS::SecretsManager::SecretTargetAttachment\n\n### Custom types\n\nThis project packages certain useful custom CloudFormation types.  These are Lambda backed types that perform\ntasks that CloudFormation does not natively support.  In order to use them, you must upload the Lambda function\nto your account and region.  The code for these functions is found in this repo under assets/custom-types.\n\n#### Remote Route 53 entries\nA given domain (or hosted zone, more specifically) must be managed out of a single AWS account.  This poses problems if you want to create resources under that domain in templates that will run out of other accounts.  A CloudFormation template can only work in one given account.  However, with Cloud Formation's custom type functionality, we use custom code to assume a role in the account that owns the hosted zone.  This requires some setup steps for each hosted zone and each account.  For instructions, please see: https://github.com/bayer-group/cloudformation-template-generator/blob/master/assets/custom-types/remote-route53/README.md for more.\n\n## Working with Cloudformation Concatenating\nIn the CloudFormation DSL, there is support for concatenating strings, parameters, and function calls together to build strings.\nThis can get really ugly as they are chained together.\nThere is a [string interpolator](http://monsantoco.github.io/cloudformation-template-generator/latest/api/#com.monsanto.arch.cloudformation.model.package$$AwsStringInterpolator) to make this easier.\n\n**Update 11/17/2016:** While we are not deprecating this functionality at this time, CFTG now supports `Fn::Sub`, a native way to do something very similar.  It can replace both `Fn::Join` and many uses of `Fn::GetAtt`.  Read more [here](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-sub.html).\n\n## Releasing\n\nMake sure the changes for the release are included in CHANGELOG.md.\n\nThis project uses the sbt release plugin.  After the changes you want to\nrelease are committed on the master branch, you simple need to run two\ncommands to publish the library and its documentation.\n\n    sbt release\n    sbt ghpagesPushSite\n\nAfter publishing, create a new release under Github [releases](https://github.com/bayer-group/cloudformation-template-generator/releases), copying the portion of the change log for this release from CHANGELOG.md.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBayer-Group%2Fcloudformation-template-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FBayer-Group%2Fcloudformation-template-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBayer-Group%2Fcloudformation-template-generator/lists"}