File tree Expand file tree Collapse file tree 6 files changed +88
-8
lines changed Expand file tree Collapse file tree 6 files changed +88
-8
lines changed Original file line number Diff line number Diff line change 7
7
8
8
# Archivos de comiplación de Terraform
9
9
* .tfstate
10
- / .terraform
10
+ .terraform
11
11
* .tfstate. *
12
- * .tfvars
12
+ * .tfvars
13
+ * .out
14
+ * .lock.hcl
Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ variable "container_app_env_name" {
58
58
}
59
59
```
60
60
61
- Y por último:
61
+ Y por último ** main.tf ** .
62
62
63
63
``` terraform
64
64
resource "random_pet" "rg_name" {
@@ -70,12 +70,12 @@ resource "azurerm_resource_group" "rg" {
70
70
location = var.resource_group_location
71
71
}
72
72
73
- resource "azurerm_container_registry" "acr" {
74
- name = var.acr_name
75
- resource_group_name = azurerm_resource_group.rg.name
73
+ resource "azurerm_application_insights" "app_insights" {
74
+ name = "${var.resource_group_name_prefix}-ai"
76
75
location = azurerm_resource_group.rg.location
77
- sku = "Standard"
78
- admin_enabled = true
76
+ resource_group_name = azurerm_resource_group.rg.name
77
+ application_type = "web"
78
+ workspace_id = azurerm_log_analytics_workspace.log_analytics.id
79
79
}
80
80
81
81
resource "azurerm_log_analytics_workspace" "log_analytics" {
Original file line number Diff line number Diff line change
1
+ terraform {
2
+ backend "azurerm" {
3
+ storage_account_name = " generalstorageamin"
4
+ container_name = " tfstate"
5
+ key = " devops.tfstate"
6
+ }
7
+ }
Original file line number Diff line number Diff line change
1
+ resource "random_pet" "rg_name" {
2
+ prefix = var. resource_group_name_prefix
3
+ }
4
+
5
+ resource "azurerm_resource_group" "rg" {
6
+ name = random_pet. rg_name . id
7
+ location = var. resource_group_location
8
+ }
9
+
10
+ resource "azurerm_application_insights" "app_insights" {
11
+ name = " ${ var . resource_group_name_prefix } -ai"
12
+ location = azurerm_resource_group. rg . location
13
+ resource_group_name = azurerm_resource_group. rg . name
14
+ application_type = " web"
15
+ workspace_id = azurerm_log_analytics_workspace. log_analytics . id
16
+ }
17
+
18
+ resource "azurerm_log_analytics_workspace" "log_analytics" {
19
+ name = " ${ var . resource_group_name_prefix } -law"
20
+ location = azurerm_resource_group. rg . location
21
+ resource_group_name = azurerm_resource_group. rg . name
22
+ sku = " PerGB2018"
23
+ retention_in_days = 30
24
+
25
+ identity {
26
+ type = " SystemAssigned"
27
+ }
28
+ }
29
+
30
+ resource "azurerm_container_app_environment" "apps_environment" {
31
+ name = var. container_app_env_name
32
+ location = azurerm_resource_group. rg . location
33
+ resource_group_name = azurerm_resource_group. rg . name
34
+ log_analytics_workspace_id = azurerm_log_analytics_workspace. log_analytics . id
35
+ }
Original file line number Diff line number Diff line change
1
+ terraform {
2
+ required_version = " >=1.0"
3
+ required_providers {
4
+ azurerm = {
5
+ source = " hashicorp/azurerm"
6
+ version = " ~>3.0"
7
+ }
8
+ }
9
+ }
10
+ provider "azurerm" {
11
+ features {}
12
+ subscription_id = " 30a83aff-7a8b-4ca3-aa48-ab93268b5a8b"
13
+ }
Original file line number Diff line number Diff line change
1
+ variable "resource_group_name_prefix" {
2
+ description = " Prefix for the resource group name"
3
+ type = string
4
+ default = " rg-"
5
+ }
6
+
7
+ variable "resource_group_location" {
8
+ description = " Location for the resource group"
9
+ type = string
10
+ default = " East US 2"
11
+ }
12
+
13
+ variable "acr_name" {
14
+ description = " Name of the Azure Container Registry"
15
+ type = string
16
+ default = " acrdevopsamin"
17
+ }
18
+
19
+ variable "container_app_env_name" {
20
+ description = " Name of the Azure Container App Environment"
21
+ type = string
22
+ default = " devops-env"
23
+ }
You can’t perform that action at this time.
0 commit comments