guide
Getting Started
What is Hulk?
Well, its an Avenger?
Yes and no, Hulk is a JSON Transpiler developed by our DevOps Team, built with Rust.
What Hulk can offer to me?
- Atomic JSON structure for defining Azure Resources
- Abstracts the complexity from Bicep 💪 and make your life easier
- Provides bindings between native Azure Cloud Resources and other objects (such as AAD)
Getting started with Hulk 💪
This tutorial will guide you through the entire process of creating your first Hulk project, including cloning the repo, installing the CLI and building your first project.
Prerequisites
- Cloning the Git Repository
git clone https://dev.azure.com/2020Development/Hulk%20IaC/_git/hulk-iac
If you are asked to enter Credentials you will need to generate a Personal Access Token (PAT)
Creating a new project
Run this command in your terminal:
hulk init project --team TEAM_NAME --project PROJECT_NAME
This command will create a file named "main.json" under the path TEAM_NAME\PROJECT_NAME of the hulk-iac repository
└── main.json
Adding modules (optional)
You can add modules with this command: hulk init module PATH_TO_CREATE/FILE.json
Make sure to include them via the modules property inside your main.json!
Adding resources
- Open your project folder in your favorite IDE
- Start to add resources to your definition. See an example here
Validating your project
Run the local validation pipeline before publishing artifacts. Add --require-bicep in CI so a missing compiler fails the build.
hulk check PATH --env ENVIRONMENT
hulk check PATH --env ENVIRONMENT --require-bicep --no-update
To inspect generated files after a warning or failure, add --keep-artifacts. Hulk prints the directory to open. See Debugging generated Bicep.
Use hulk synth PATH --env ENVIRONMENT when you also need Hulk’s authenticated team and resource-group permission check.
Choosing the right validation command
| Goal | Command | Azure access |
|---|---|---|
| Fast project and generated-Bicep feedback | hulk check |
Not required |
| Validate Hulk repository permissions | hulk synth |
Required |
| Validate against live Azure providers | hulk plan |
Required |
| Preview Azure resource changes | hulk plan PATH --env ENVIRONMENT --what-if |
Required |
Publish .hulk/main.bicep for deployment |
hulk transpile |
Not required |
| Create or update Azure resources | az deployment group create |
Required |
Start with check during development, add plan before merging or releasing, then use transpile plus the native ARM deployment command in the deployment pipeline.
Creating the CD Pipeline
- Run the pipeline creation command to generate the Azure pipelines .yml file
hulk pipeline create PATH
After the pipeline is created, you can commit your project
Committing
- Checkout to your new branch
git checkout -b BRANCH_NAME
- Add the new files to the branch
git add .\argvengers\TEAM_NAME\main.json .\argvengers\TEAM_NAME\cd-pipeline.yml
- Commit to the branch, don’t forget to input a commit message
git commit -m 'Initial commit for TEAM_NAME project'
- Push
git push -u origin BRANCH_NAME
Pull Request
-
Open the Hulk-Iac Repo on Azure Devops and click on “Create a Pull Request”;
-
Insert the name and the description for the Pull Request and click “Create”;
-
After your Pull Request is reviewed and merged by the DevOps team,your pipeline will be automatically created
-
Next your pipeline can be ran on specific stages to deploy your infrastructure
That’s it!