Skip to content
This repository has been archived by the owner on Feb 14, 2024. It is now read-only.

feat(MAJOR): full refactor of modules and examples #251

Merged
merged 38 commits into from
Apr 29, 2023

Conversation

FoSix
Copy link
Contributor

@FoSix FoSix commented Apr 5, 2023

Description

Full refactor of the modules and examples.
BREAKING CHANGES ahead.

Motivation and Context

Some of the modules and examples required a bigger re-work in terms of flexibility and more modern approach to TF code. We're also starting to introduce with this PR configuration options available in recent TF versions (like nullable).

How Has This Been Tested?

All examples were deployed.

Screenshots (if appropriate)

Types of changes

  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes if appropriate.
  • All new and existing tests passed.

@migara
Copy link
Member

migara commented Apr 12, 2023

Closes the following issues
#235
#237
#247
#248

Copy link
Contributor

@sebastianczech sebastianczech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job so far 👍

}

variable "img_sku" {
description = "VM-Series SKU - list available with `az vm image list -o table --all --publisher paloaltonetworks`"
default = "bundle2"
default = "byol"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏽

examples/common_vmseries/README.md Outdated Show resolved Hide resolved
examples/common_vmseries/example.tfvars Outdated Show resolved Hide resolved
examples/common_vmseries/example.tfvars Outdated Show resolved Hide resolved
@@ -1,3 +1,9 @@
variable "name_prefix" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The need for adding a name_prefix at module level can be mitigated in the "glue code", please refer to this example: https://github.com/PaloAltoNetworks/terraform-google-vmseries-modules/pull/182/files#diff-8fdcb1bfa2b32baa79c1716fd9558e3ef35f1ad0a13bc71267300689ddf9e206R64

location = var.location

workspace_mode = try(var.application_insights.workspace_mode, null)
workspace_name = try(var.application_insights.workspace_name, "${var.name_prefix}${each.key}-wrkspc")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

@FoSix FoSix Apr 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment same as here

.gitignore Outdated Show resolved Hide resolved
examples/standalone_panorama/example.tfvars Outdated Show resolved Hide resolved
examples/standalone_panorama/example.tfvars Outdated Show resolved Hide resolved
examples/standalone_panorama/outputs.tf Outdated Show resolved Hide resolved
@@ -3,13 +3,22 @@ resource "azurerm_public_ip" "this" {

location = var.location
resource_group_name = var.resource_group_name
name = each.value.name
name = "${each.value.name}-pip"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can see this suffix being added throughout the PR, in different modules. I think we should avoid any static suffixes in resource names whenever possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not see a place where they could harm the code or usability. Especially that these are only names, we operate on keys everywhere, so the code does not depend on them.

And it is more readable when you look in Azure portal. Keeping the naming schema, where each related resource get's a prefix in the form of the main resource + some suffix that usually describes a type of a resource groups the related resources together:
image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what we could do is work on keeping the suffixes the same across modules. Or even make them configurable, example: public IP get's -pip but you can overwrite it with a variable (one variable for all PIP suffixes)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can be opinionated here with the prefixes(ie. pip, nsg, etc.). I don't have a strong preference. If we need to have a variable to control the suffix let's do that via another PR

@horiagunica horiagunica marked this pull request as ready for review April 25, 2023 18:12
@horiagunica horiagunica requested a review from a team as a code owner April 25, 2023 18:12
@FoSix FoSix changed the title feat!: full refactor of modules and examples feat(MAJOR): full refactor of modules and examples Apr 26, 2023
@@ -3,13 +3,22 @@ resource "azurerm_public_ip" "this" {

location = var.location
resource_group_name = var.resource_group_name
name = each.value.name
name = "${each.value.name}-pip"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can be opinionated here with the prefixes(ie. pip, nsg, etc.). I don't have a strong preference. If we need to have a variable to control the suffix let's do that via another PR

@migara migara merged commit c8b4417 into main Apr 29, 2023
@migara migara deleted the modules_refactor_4_flexibility branch April 29, 2023 08:56
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants