You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Collapse multiple modules into one where it makes sense
Keep the module separated as is if the complexity going to increase
Restructure the naming of the outputs (align input and output names where applicable and also keep consistency in the noun usage across modules). This will improve the readability of the code for users
Variables ordering
Some basic principles:
ensure the variable descriptions are consistent across all the examples (and modules if applicable)
unless a module is constructed in a different way, variables.tf should be sorted based on logical hierarchical order:
name
region
keep vars related to the same type of resource next to each other, i.e. create_subnets should be next to subnets
order the variables, either:
based on decision steps when designing infrastructure, i.e. create_subnets 1st, then subnets definition (you have to decide if you create subnets, or do you source them, then you provide the specs, which will differ based on your decision)
based on dependencies between resources, i.e. you define SGs and RTs 1st, then Subnets, as in subnets variable we point to already defined SGs and RTs
if no other criteria matches, based on importance or usage frequency
group the variables into more complex objects where it makes sense and improves module's readability, e.g. variable interfaces grouping all network interface related settings
Keep in mind that his order will be retained in a README.md.
Description format
Follow the example below:
description=<<-EOFA short, one sentence description of the variable.Some more detailed description, can be multiple lines.List of either required or important properties:- `name` - (`string`, required) name of the Network Security Group.- `some_optional_value` - (`string`, optional, defaults to `null`) some description.- `some_complex_property` - (`map`, optional) A list of objects representing something. - `name` - (`string`, required) name of the something. - `some_number` - (`number`, optional, defaults to `5`) numeric value. - `some_value_1` - (`string`, required, mutually exclusive with `some_value_2`) some description. - `some_value_2` - (`string`, required, mutually exclusive with `some_value_1`) some description. - `some_optional_value` - (`bool`, optional, defaults to `false`) some description.List of other, optional properties:- `less_important_1` - (`string`, optional, defaults to `null`) some description.- `less_important_2` - (`string`, optional, defaults Azure defaults) some description.- `less_important_3` - (`string`, optional, defaults to `""`) some description.- `less_important_4` - (`list(string)`, optional, defaults to `[]`) some description.Example:```hcl{ "object_1" = { name = "name of object 1" ..... }}```EOF
Common variables
Replace the following variables with these definitions:
variable"name" {
description="The name of the Virtual Private Network."type=string
}
variable"tags" {
description="The map of tags to assign to all created resources."default={}
type=map(string)
}
Bootstrap options for examples
The new examples will support the default bootstrap method (user-data) and may be ability to use other bootstrap methods as options (by commenting out certain variables)
The text was updated successfully, but these errors were encountered:
Hub issue for major refactor of examples and modules for GCP SWFW.
Introduction
optional
keyword.header.md
variables.tf
in order that makes sense (see below)name
ortags
(see below for a copy&paste pattern to follow)lookup
/try
statements where possible -> rely on default values (for complex variables as well)enable_zones
- use smart defaults insteadmain.tf
for groups of deployments e.g. VM-Series , autoscaling, Cloud NGFW, Panorama or others if required# EXAMPLE \n
comment format to indicate a start of a sectionIssues per module
(many issues have already been merged to main refactor branch in the old archived repo)
Issues per example
Module Refactor Considerations
set
concept in the current modules.noun
usage across modules). This will improve the readability of the code for usersVariables ordering
Some basic principles:
variables.tf
should be sorted based on logical hierarchical order:name
region
create_subnets
should be next tosubnets
create_subnets
1st, thensubnets
definition (you have to decide if you create subnets, or do you source them, then you provide the specs, which will differ based on your decision)subnets
variable we point to already defined SGs and RTsinterfaces
grouping all network interface related settingsKeep in mind that his order will be retained in a
README.md
.Description format
Follow the example below:
Common variables
Replace the following variables with these definitions:
Bootstrap options for examples
The new examples will support the default bootstrap method (user-data) and may be ability to use other bootstrap methods as options (by commenting out certain variables)
The text was updated successfully, but these errors were encountered: