-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from Think-Cube/patch-1
Reorganize
- Loading branch information
Showing
9 changed files
with
137 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
resource "azurerm_application_insights" "main" { | ||
name = "${var.environment}-${var.application_insights_name}-${var.region}-appi" | ||
location = "${data.azurerm_resource_group.rg.location}" | ||
resource_group_name = "${data.azurerm_resource_group.rg.name}" | ||
application_type = "${var.application_insights_type}" | ||
workspace_id = "${azurerm_log_analytics_workspace.main.id}" | ||
location = data.azurerm_resource_group.main.location | ||
resource_group_name = data.azurerm_resource_group.main.name | ||
application_type = var.application_insights_type | ||
workspace_id = azurerm_log_analytics_workspace.main.id | ||
tags = var.default_tags | ||
|
||
tags = "${var.default_tags}" | ||
|
||
depends_on = [ azurerm_log_analytics_workspace.main ] | ||
depends_on = [azurerm_log_analytics_workspace.main] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
terraform { | ||
required_providers { | ||
azurerm = { | ||
source = "hashicorp/azurerm" | ||
version = "3.3.0" | ||
source = "hashicorp/azurerm" | ||
version = "3.94.0" | ||
} | ||
} | ||
required_version = ">= 0.15" | ||
} | ||
required_version = ">= 1.6.4" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,19 @@ | ||
## How to use | ||
# Azure Application Insights Terraform Module | ||
|
||
``` | ||
This Terraform module provisions an Azure Application Insights instance and a Log Analytics Workspace, integrated with the specified settings. | ||
|
||
## Usage | ||
|
||
### Example | ||
|
||
```hcl | ||
provider "azurerm" { | ||
features {} | ||
} | ||
module "app-insights" { | ||
source = "spy86/app-insights/azure" | ||
version = "1.0.4" | ||
source = "Think-Cube/app-insights/azure" | ||
version = "1.0.0" | ||
application_insights_name = "dd5ce8a0" | ||
log_analytics_workspace_name = "bf308ab897c3" | ||
resource_group_name = "weu-test-rg" | ||
|
@@ -19,11 +25,40 @@ module "app-insights" { | |
region = "weu" | ||
default_tags = { | ||
Administrator = "Someone" | ||
Department = "IT" | ||
CostCentre = "ABC123" | ||
ContactPerson = "[email protected]" | ||
Administrator = "John Doe" | ||
Department = "IT" | ||
CostCentre = "CC123" | ||
ContactPerson = "Jane Smith" | ||
ManagedByTerraform = "True" | ||
} | ||
} | ||
``` | ||
``` | ||
|
||
### Variables | ||
|
||
* `application_insights_name`: Name of the Azure Application Insights instance. | ||
* `log_analytics_workspace_name`: Name of the Log Analytics Workspace. | ||
* `resource_group_name`: Name of the Azure resource group. | ||
* `resource_group_location`: Location of the Azure resource group. | ||
* `application_insights_type`: Type of Application Insights (e.g., web). | ||
* `environment`: Environment for the resources (e.g., dev, prod). | ||
* `log_analytics_workspace_retention_in_days`: Retention period for Log Analytics data (in days). | ||
* `log_analytics_workspace_sku`: SKU for the Log Analytics Workspace. | ||
* `region`: Azure region for the resources. | ||
* `default_tags`: Default tags to be applied to all resources. | ||
|
||
### Outputs | ||
|
||
* `application_insights_id`: The ID of the created Application Insights instance. | ||
* `log_analytics_workspace_id`: The ID of the created Log Analytics Workspace. | ||
* `log_analytics_workspace_primary_shared_key`: Primary shared key of the created Log Analytics Workspace. | ||
* `log_analytics_workspace_secondary_shared_key`: Secondary shared key of the created Log Analytics Workspace. | ||
* `log_analytics_workspace_customer_id`: Customer ID of the created Log Analytics Workspace. | ||
|
||
## License | ||
|
||
This project is licensed under the [MIT License](https://opensource.org/licenses/MIT). | ||
|
||
## Contribution | ||
|
||
Feel free to contribute by opening issues or pull requests. Your feedback and improvements are highly appreciated! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
resource "azurerm_log_analytics_workspace" "main" { | ||
name = "${var.environment}-${var.log_analytics_workspace_name}-${var.region}-log" | ||
location = "${data.azurerm_resource_group.rg.location}" | ||
resource_group_name = "${data.azurerm_resource_group.rg.name}" | ||
sku = "${var.log_analytics_workspace_sku}" | ||
retention_in_days = "${var.log_analytics_workspace_retention_in_days}" | ||
|
||
tags = "${var.default_tags}" | ||
location = data.azurerm_resource_group.main.location | ||
resource_group_name = data.azurerm_resource_group.main.name | ||
sku = var.log_analytics_workspace_sku | ||
retention_in_days = var.log_analytics_workspace_retention_in_days | ||
tags = var.default_tags | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
data "azurerm_client_config" "current" {} | ||
|
||
data "azurerm_resource_group" "rg" { | ||
name = "${var.resource_group_name}" | ||
data "azurerm_resource_group" "main" { | ||
name = var.resource_group_name | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,24 @@ | ||
output "id" { | ||
description = "ID of the Application Insights component." | ||
value = "${azurerm_application_insights.main.id}" | ||
sensitive = false | ||
output "application_insights_id" { | ||
description = "The ID of the created Application Insights instance." | ||
value = azurerm_application_insights.main.id | ||
} | ||
output "instrumentation_key" { | ||
description = "App ID associated with this Application Insights component." | ||
value = "${azurerm_application_insights.main.instrumentation_key}" | ||
sensitive = false | ||
|
||
output "log_analytics_workspace_id" { | ||
description = "The ID of the created Log Analytics Workspace." | ||
value = azurerm_log_analytics_workspace.main.id | ||
} | ||
|
||
output "log_analytics_workspace_primary_shared_key" { | ||
description = "Primary shared key of the created Log Analytics Workspace." | ||
value = azurerm_log_analytics_workspace.main.primary_shared_key | ||
} | ||
|
||
output "app_id" { | ||
description = "Instrumentation Key for this Application Insights component." | ||
value = "${azurerm_application_insights.main.app_id}" | ||
sensitive = false | ||
} | ||
output "log_analytics_workspace_secondary_shared_key" { | ||
description = "Secondary shared key of the created Log Analytics Workspace." | ||
value = azurerm_log_analytics_workspace.main.secondary_shared_key | ||
} | ||
|
||
output "log_analytics_workspace_customer_id" { | ||
description = "Customer ID of the created Log Analytics Workspace." | ||
value = azurerm_log_analytics_workspace.main.customer_id | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters