Hello Guys, I’m start to use terraform the first time in a MVP projetct.
My target is, put de terraform script to run from on AzureDevops and provide DEV/QA and Prod infrastructure.
At the moment, using power shell, I’m able to create all resources as i need, from terraform.exe
But on azure devops configuration, the firts steps i need select resource group,
Is there any way, to run without this configuration? As a wanna create all resources using terraform.
Here is the firts part off my terraform script - main.tf
provider "azurerm" {
features {
key_vault {
purge_soft_delete_on_destroy = false
}
}
}
data "azurerm_client_config" "current" {}
resource "azurerm_resource_group" "resource_group" {
name = "rg_dynamics_${var.project}_${var.environment}"
location = var.location
}
resource "azurerm_storage_account" "storage_account" {
name = "stvmdynamics${var.environment}"
resource_group_name = azurerm_resource_group.resource_group.name
location = var.location
account_tier = "Standard"
account_replication_type = "GRS"
}
resource "azurerm_application_insights" "application_insights" {
name = "${var.project}-${var.environment}-application-insights"
location = var.location
resource_group_name = azurerm_resource_group.resource_group.name
application_type = "web"
}
resource "azurerm_service_plan" "app_service_plan" {
name = "plan_dynamics_${var.project}_${var.environment}"
resource_group_name = azurerm_resource_group.resource_group.name
location = var.location
os_type = "Windows"
sku_name = "F1"
}
#=====================================app autentication======================
resource "random_uuid" "randomGuid" {
}
resource "azuread_application" "app_registration" {
display_name = "app-registration-${var.project}-${var.environment}"
owners = [data.azurerm_client_config.current.object_id]
sign_in_audience = "AzureADMyOrg"
identifier_uris = ["api://app-registration-${var.project}-${var.environment}"]
}
#================================================================================
#============================inicio de functions======================
resource "azurerm_windows_function_app" "function_app_atcad" {
name = "func-dynamics-atualizacao-cad-rec-${var.environment}"
resource_group_name = azurerm_resource_group.resource_group.name
location = var.location
service_plan_id = azurerm_service_plan.app_service_plan.id
storage_account_name = azurerm_storage_account.storage_account.name
storage_account_access_key = azurerm_storage_account.storage_account.primary_access_key
https_only = true
site_config {
application_stack {
dotnet_version = "6"
}
}
identity {
type = "SystemAssigned"
}