[ ] add resource "aws_lb_target_group_attachment" to vm_series module
[ ] Move and simplify locals about subinterfaces and bootstrap to vm_series modules
[ ] Spokes
[ ] Reflect test_infrastructure module from Azure to AWS. (To create tests spokes vms, etc.)
Issues per example
TBD
Module Refactor Considerations
Reconsider the implementation of set concept in the current modules.
Avoid rigid variable construction concepts (for example, implicit specification of variables which means the first time users need to have some domain specific knowledge in order to use the example. For more context https://github.com/PaloAltoNetworks/terraform-aws-swfw-modules/pull/49)
Collapse multiple modules into one where it makes sense
Keep the module separated as is if the complexity going to increase (example: NLB and ALB modules)
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 = <<-EOF
A 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:
```hcl
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 [Done]
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)
This issue tracks all the major refactoring of the examples and modules to make it more readable and usable.
Background: https://github.com/PaloAltoNetworks/terraform-aws-swfw-modules/issues/37
An issue tracker for modules (and examples) refactor.
Introduction
The key points to address when refactoring the modules:
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
in examples e.g. constructing bootstrap options with GWLB endpoints: https://github.com/PaloAltoNetworks/terraform-aws-swfw-modules/blob/ded78a9a6825f8d3f490fbec47a9e6a536ba5774/examples/combined_design/main.tf#L242-L257main.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:
EOF
Bootstrap options for examples [Done]
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)