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

refactor(module/application_insights)!: module refactor and adjusted examples #346

Closed

Conversation

alperenkose
Copy link
Contributor

Description

Closes #326

This branch is based on #307.

Types of changes

  • 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.

@alperenkose alperenkose requested a review from a team as a code owner October 13, 2023 15:18
@alperenkose alperenkose changed the title refactor(module/application_insights)!: refactor of the Application Insights module refactor(module/application_insights)!: module refactor and adjusted examples Oct 13, 2023
@FoSix FoSix added the refactor label Oct 19, 2023
Copy link
Contributor

@FoSix FoSix left a comment

Choose a reason for hiding this comment

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

some minor thing to check

rebase with 307 before mergining

Comment on lines +17 to +23
provider "azurerm" {
features {
resource_group {
prevent_deletion_if_contains_resources = false
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

try to avoid indented code blocks in favour of explicit ones, with langugae notation

Suggested change
provider "azurerm" {
features {
resource_group {
prevent_deletion_if_contains_resources = false
}
}
}
```hcl
provider "azurerm" {
features {
resource_group {
prevent_deletion_if_contains_resources = false
}
}
}
```


In both situations the instrumentation key for the Application Insights has to be provided in the firewall's configuration. For more information please refer to [documentation](https://docs.paloaltonetworks.com/vm-series/10-2/vm-series-deployment/set-up-the-vm-series-firewall-on-azure/enable-azure-application-insights-on-the-vm-series-firewall).

**NOTICE**
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we could use GH admonitions? to make it look better?


The following snippet deploys Application Insights and Log Analytics Workspace, setting the retention to 1 year.

```hcl
Copy link
Contributor

Choose a reason for hiding this comment

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

the example is obsolete, for example the worskspace name is required

@@ -1,23 +1,31 @@
variable "name" {
description = "Name of the Application Insights instance."
type = string
nullable = false
Copy link
Contributor

Choose a reason for hiding this comment

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

nullable makes sense only if you have a default value

type = string
nullable = false
}

variable "workspace_sku" {
Copy link
Contributor

Choose a reason for hiding this comment

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

two things here:

  1. multiline description, an EOF like notation would probably look better
  2. check if the default value is still PerGB2018. Maybe we could drop default here and null this value instead, to relay on Azure defaults. If it's not possible, add nullable to force the default value.

@@ -31,19 +39,3 @@ variable "metrics_retention_in_days" {
default = null
Copy link
Contributor

Choose a reason for hiding this comment

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

Multiline description, add EOF notation

And maybe block-quote the possible values, like: 0, 30, 60, etc


Properties supported (for details on each property see [modules documentation](../../modules/application_insights/README.md)):
For detailed documentation on each property refer to [module documentation](../../modules/application_insights/README.md)
Copy link
Contributor

Choose a reason for hiding this comment

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

there are only 4 properties here, I would avoid pointing the user to module's documentation if it's not really necensary, like when you omit some nested props to avoid duplicating documentation.

type = map(object({
name = string
workspace_name = string
workspace_sku = optional(string, "PerGB2018")
Copy link
Contributor

Choose a reason for hiding this comment

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

see comment around workspace_sku variable, if we need to keep the default value in the module's variable definition, add nullable to the definition, skip the default value here. This way you control the default value only in one place and you do not overwrite it in the example code.

- `metrics_retention_in_days` : (optional, number) defaults to current Azure default value, see module documentation for details
- `name` - (`string`, required) name of the Application Insights instance.
- `workspace_name` - (`string`, required) name of the Log Analytics Workspace to be created together with the AI instance.
- `workspace_sku` - (`string`, optional, defaults "PerGB2018") SKU used by WAL, for details see [Application Insights module documentation](../../modules/application_insights/README.md#workspace_sku).
Copy link
Contributor

Choose a reason for hiding this comment

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

if we need to keep the default value in the module, set the parentised text to soemthing like optional, default to module defaults

@FoSix
Copy link
Contributor

FoSix commented Nov 13, 2023

this will be refactored with the #335

@FoSix FoSix closed this Nov 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants