Building and using your own CloudFormation modules
If you come from the Terraform realm, you will have likely heard about modules before. Hence, I think it’s fair to do a quick comparison between Terraform and CloudFormation module functionality.
Comparing Terraform and CloudFormation modules
A Terraform module is a generic configuration stored in a local directory or repository. Consider the following Terraform files:
// instance.tfresource "aws_instance" "instance" {
# some resource properties
instance_type = var.type
}
// variables.tf
variable "type" {}
We can refer to this module via a directory, similar to how we would refer to templates in nested stacks:
// main.tfmodule "my_instance" {
source = "path/to/module/"
type = "t3.nano"
}
The module is being referred to in a source property, followed by module variables.
Terraform modules support versioning...