Cfgen.Template provides the constructs needed to create a template, add resources, parameters and outputs, and then serialise it with YojsonCfgen.BaseConstructs contains the generated CloudFormation constructs arranged into an AWS and Alexa namespace, with helpers for creating resource properties (and their associated sub-types)Cfgen.Helpers contains DSL helpers for constructing inline values for AWS-specific DSLs, like IAM policies.open Cfgen
let my_template_creator =
let template = Template.make () in
templateCfgen.BaseConstructs, which are in a Namespace.Service.Resource hiearchy.For example, AWS IAM Roles are in Cfgen.BaseConstructs.AWS.IAM.Role module
make_properties helper in the module(These helpers save you needing to specify optional values on resources with lots of properties, which is very common in AWS)
open Cfgen.BaseConstructs
let create_role template =
let tags = [AWS.IAM.Role.make_tag ~key:"Environment" ~value:"Development" ()] in
let props = AWS.IAM.Role.make_properties
~assume_role_policy_document: assume_role
~tags
() in
...Some properties have record types, which also have their own make_<type_name> function
logical_id to uniquely identify it in the templateopen Cfgen.BaseConstructs
let create_role =
let props = ... in
Template.add_resource template "MyRole" (module AWS.IAM.Role) props ()