Workflow & Stack Templates

Workflow Template​
Infrastructure as Code (IAC) templates are automated blueprints for provisioning and managing infrastructure through code. They facilitate rapid and reliable environment setup, with version control for easy collaboration and updates.
Create a Workflow Template​
To create a workflow template, navigate to Marketplace Home and select 'Create Template' in the top-right corner.
Let's step through crafting a demo template for an AWS EC2 instance.
Template Details​
- Template type: Preselected as IAC.
- Template Name: Unique identifier, e.g.,
aws-ec2-demo. - Owner Org: Your organization name.
- Short Description: Brief description, e.g., "EC2 instance setup template for production environment".
Documentation & Configuration​
- Documentation: Include any pertinent notes or a URL to comprehensive documentation.
- Source Config Kind: Select the IAC tool, e.g., Terraform from available options.
- Source Destination Kind: Choose the repository service, e.g., Github.
- Repository URL: Enter the URL where the IAC configuration is hosted.
- Reference: Specify the Git branch or tag, like
mainorv2.0.1.
Additional Settings​
- Working Dir: Directory path for the IAC configuration if not at the repo's root.
- Git Sparse Checkout Config: Git Sparse Checkout Config: Specify paths to include or exclude for the repository checkout, akin to .gitignore. By default we checkout the full repository.
- Enable git core.autocrlf: Tick if you need to normalize line endings.
- Private Source: Mark this for private repositories and provide an authentication method.
Template Inputs​
Select between FORM and JSON for input methods. Here's a JSON example for creating a simple EC2 instance:
{
"create": true,
"name": "production-instance",
"instance_type": "t2.micro",
"ami": "ami-0110d1b5b1cdd8780",
"key_name": "production-key",
"vpc_security_group_ids": ["sg-12345678"],
"subnet_id": "subnet-12345678"
}

Fig: Creating an IAC Template
Create and Manage Template Revisions​
All template types in StackGuardian support versioned revisions for controlled deployment and collaboration. You can select, clone, publish, deprecate versions and more. Visit the Manage Template Revision guide.
Stack Template​
Stack Template are sets of interrelated workflow templates that orchestrate the provisioning of infrastructure components. They simplify the management of complex environments by combining templates into a unified workflow.
For instance, a Stack might include templates for setting up databases, servers, and load balancers that are deployed together to form a scalable web application environment.
Creating a Stack Template (Iac Groups)​
A Stack Template in Stackguardian is your way to cohesively manage a suite of related infrastructure templates, like those needed to deploy a web application stack in AWS.
Start Template Creation​
Begin by going to Marketplace Home and click on 'Create Template' at the top-right corner.
Input Stack Template Details​
- Template Name: Assign a descriptive name, such as 'web-store-app'.
- Owner Org: Choose your organization from the provided list.
- Short Description: Describe the group's purpose, like 'Templates for a complete web store infrastructure'.
Template Selection​
Choose from Stackguardian's public templates or your own creations. For a deep dive, check out IAC template documentation.
- Add Template: Incorporate your chosen templates and select the latest revision to ensure the group uses the most current configurations.
After adding, you have the option to check "Overwrite Template Defaults" if you need to customize the template settings further.
Ordering Templates​
Correctly sequence your templates by dragging them into the desired order, paying attention to dependency requirements.
Group Finalization​
After setting up, hit 'Create' to finalize your Stack Template.

Fig: Creating a Stack Template
Create and Manage Template Revisions​
All template types in StackGuardian support versioned revisions for controlled deployment and collaboration. You can select, clone, publish, deprecate versions and more. Visit the Manage Template Revision guide.