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
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 fix(examples): Refactor examples for reference architectures #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=<<-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 [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)
The text was updated successfully, but these errors were encountered:
migara
changed the title
Example Refactor
Major refactor for modules and examples
Jun 27, 2024
* remove subnet_set module
* extend vpc module to create subnets and route tables
* simplify subnets creation (not using complex locals from subnet_set module)
* adjust the variables in variables.tf and outputs inoutputs.tf in order that makes sense
* refactor variables e.g. create new variable internet_gateway, which defines object with attributes for IGW creation/usage
* adjust variables description to standard from Major refactor for modules and examples #53
* adjust all examples to new approach with vpc module
* adjust CloudNGFW examples to changes delivered for other examples in fix(examples): Refactor examples for reference architectures #49
* change approach for CloudWatch logs group in CloudNGFW (as the same name PaloAltoCloudNGFW has to be used for both examples, groups was created on account used in workflows and in TFVARS we are not creating new log group, we are reusing existing one)
* added support for all possible attributes for every resource used in module
* README changed to new standard with new file .header.md
Co-authored-by: michalbil <[email protected]>
This issue tracks all the major refactoring of the examples and modules to make it more readable and usable.
Background: #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:terraform-aws-swfw-modules/examples/combined_design/main.tf
Lines 242 to 257 in ded78a9
main.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)
subnet_set
andvpc
modules #62vpc_route
module - move and simplify locals #70vpc_route
module - simplify outputs from depended modules (i.e. gwlb_endpoint_set, natgw_set) #90Issues 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 [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)
The text was updated successfully, but these errors were encountered: