Core Concepts
...
Components
CloudFormation
Custom Input Params
3min
when working with cloudformation components in microtica, you may find the need to add custom input parameters to your templates these parameters can help make your components more flexible and configurable step 1 update the json schema (schema json) first, you need to define the new accesscontrol parameter in the schema json file this will ensure that the parameter is visible and configurable in the microtica console here is how you can update the schema json file { "$schema" "http //json schema org/draft 07/schema#", "$id" "schema //microtica/component aws s3 json", "title" "component schema", "type" "object", "properties" { "inputs" { "type" "object", "properties" { "bucketname" { "type" "string", "description" "the name of the bucket " }, "accesscontrol" { "type" "string", "description" "the access control setting for the s3 bucket ", "enum" \["private", "publicread"] } }, "required" \[ "bucketname", "accesscontrol" ], "additionalproperties" false } }, "additionalproperties" false } in this update the accesscontrol parameter is added under properties with the description and two allowed values ( enum ) "private" and "publicread" the parameter is also included in the required array to ensure it must be provided during deployment step 2 update the cloudformation template (index json) next, you need to update the index json file to include the new accesscontrol parameter in the cloudformation template this parameter will be used to set the appropriate access control policy on the s3 bucket hereβs the updated index json file { "awstemplateformatversion" "2010 09 09", "description" "aws s3 bucket custom component", "parameters" { "bucketname" { "type" "string", "default" "", "description" "the name of the s3 bucket" }, "accesscontrol" { "type" "string", "description" "the access control setting for the s3 bucket ", "allowedvalues" \["private", "publicread"], "default" "private" } }, "resources" { "s3bucket" { "type" "aws s3 bucket", "properties" { "bucketname" { "ref" "bucketname" }, "accesscontrol" { "ref" "accesscontrol" } } } }, "outputs" { "bucketname" { "value" { "ref" "s3bucket" }, "description" "name of the s3 bucket" } } } in this update the accesscontrol parameter is added under parameters , with allowed values "private" and "publicread" the default value is set to "private" the accesscontrol property is referenced in the s3bucket resource definition, linking it to the corresponding parameter value provided during deployment