Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement a standardized pattern for setting parameters on Bicep examples #618

Closed
brooke-hamilton opened this issue Jan 21, 2022 · 1 comment
Labels
bicep Related to Bicep code examples Related to content in the `src/bicep/examples` folder 🗻 Large scope

Comments

@brooke-hamilton
Copy link
Contributor

brooke-hamilton commented Jan 21, 2022

Benefit/Result/Outcome

So that an IT Admin has flexibility in how to run Bicep/ARM templates in the bicep/examples folder.

Description

Most of our examples use the shared variable pattern for invoking the Bicep templates. It is a good pattern, however, it is limited because the user is required to have a json file with a hard-coded name and structure, and Bicep compiles the contents of the file into the ARM template, preventing us from adding the ARM template to the repo.

We want to continue to support the shared variable file pattern, but we need to also support other patterns for setting parameters, including using a parameters file, a PoweShell object, command line parameters, environment variables, and the deployment resource provider.

The scope of this work includes:

  • Establishing a pattern that all examples can implement, including required files, file names, etc.
  • Implementing the pattern on all existing examples
  • Documentation in the bicep/examples/README.md

There may be need to add additional templates to each example, e.g., using the shared variable file pattern may require having a separate template that loads the shared variable file and executes the main example template as a module.

Here's an example of what the pattern could look like. This is not a specification, but an example of how to implement the acceptance criteria for this backlog item.

examples
└── tier3
    ├── deployment-rp.tier3.bicep  <-- Bicep template that uses Azure deployment resource provider to look up MLZ deployment outputs and map to tier3 template inputs.
    ├── README.md                    <-- Parameter documentation. Link to parent folder README.md for how to execute the template.
    ├── parameters.tier3.json        <-- Example of a Bicep parameters file in json, with values defaulted from tier3.bicep.
    ├── parameters.tier3.ps1         <-- Example of a PowerShell parameters object, with values defaulted from tier3.bicep.
    ├── shared-variable.tier3.bicep  <-- Bicep template that uses the shared variable file pattern and maps parameter values to tier3.bicep.
    ├── tier3.bicep                  <-- The main template for the example.
    └── tier3.json                   <-- The ARM template compiled from the tier3.bicep template.

NOTE: The above is an example of a repeatable pattern to implement for all examples. It is not requirements or specification.

Automation could be used to generate some of the files, like the json parameters file and the PowerShell parameters object file.

See #536 for additional context.

Acceptance Criteria

  • The bicep/examples folder contains a readme with descriptions of the patterns and examples for running the examples using the patterns below.
  • A pattern is established for all examples and guidance exists for developers on how to implement the pattern.
  • Naming conventions are established for files in the examples folder.
  • Optional: an automated way of generating some of the files, like a json parameters file and a PowerShell parameters object.
  • All examples are updated to allow for using these methods to set template parameters:
@brooke-hamilton brooke-hamilton added needs triage bicep Related to Bicep code examples Related to content in the `src/bicep/examples` folder labels Jan 21, 2022
@brooke-hamilton brooke-hamilton added the 🗻 Large scope label Feb 3, 2022
@glennmusa glennmusa moved this from Current Backlog to In Progress in Mission Landing Zone 2022 Feb 16, 2022
@glennmusa glennmusa self-assigned this Feb 16, 2022
@glennmusa glennmusa moved this from In Progress to Current Backlog in Mission Landing Zone 2022 Mar 1, 2022
@glennmusa glennmusa removed their assignment Mar 1, 2022
@brooke-hamilton brooke-hamilton moved this from Current Backlog to In Progress in Mission Landing Zone 2022 Mar 29, 2022
@brooke-hamilton brooke-hamilton moved this from In Progress to Current Backlog in Mission Landing Zone 2022 Mar 31, 2022
@brooke-hamilton brooke-hamilton moved this from Current Backlog to Future Backlog in Mission Landing Zone 2022 Apr 7, 2022
@jamasten
Copy link
Contributor

Not implementing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bicep Related to Bicep code examples Related to content in the `src/bicep/examples` folder 🗻 Large scope
Projects
No open projects
Status: Future Backlog
Development

No branches or pull requests

3 participants