This library contains T4 templates for auto-generating Azure ARM template parameter files for environments that are custom defined. Example of environments: "dev", "qa", "prod"
- The shape of the json input used by the .tt template must match the shape of the C# classes defined in the Input folders or viceversa
- Depends on .NET 4.6.1
- VS 2017
- Download the VS solution locally and build it
- Modify the {resourceName].parameters.input.json file accordingly
- Open the {resourceName}.parameters.tt file and save the file. This will execute the T4 template and generate the parameters per environment output files
- Click the arrow to the left of the {resourceName}.parameters.tt file name. You should now see {resourceName}.parameters-{environment}.json files depending on the environments that were defined in the input .json file
- In order to use these generated parameters files, you'll need the {resourceName}.template.json file which contains the Azure ARM template definition for creating multiple instances of that same namespace based on the autogenerated {resourceName}.parameters-{environment}.json file
- Existing definition of Azure ARM templates allows the deployment of multiple instances of Azure resources. This definition, however, supports only the ability to iterate through an array of top-level Azure resources. This means that if you have an array of children with grandchildren resources that you need to iterate through as part of a parent resource defined in another array, your only option at the moment is to move that child/grandchildren resources array to the top level and duplicate parent resource information. In summary, ARM templates do not currently support defining "loops within loops" using json.
- This duplication of data becomes tedious to maintain and could lead to engineers making mistakes when copying/pasting information
- To cut down the amount of time a developer or devops engineer would spend creating json ARM template parameter files
- To ensure that there is consistency with naming conventions of Azure resources defined in ARM .json templates
For every top-level Azure resource, you'll find a folder that corresponds to the name of that resource. Under this folder you'll find Input and Output folders:
-
The Input folder contains the C# Root class and inner classes which must map 1-1 to the json object defined in the ** {resourceName}.parameters.input.json** file.
-
The Output folder contains the C# Root class and inner classes which must map 1-1 to the expected shape of the {resourceName}.parameters-{environment}.json file which must follow Azure ARM template conventions.
Once the C# logic gets an instance of this root input class, it'll convert the root input instance object to a Dictionary<string, ResourceParametersRootOutput> dictionary where each key in the dictionary represents the environment that the resource would be created under.
- Add validation logic to insure that the input Root object data is correct
- Add additional T4 templates and c# code to support ALL ARM template resources
Namespaces > Queues