Skip to content

Instantly share code, notes, and snippets.

View goyalmohit's full-sized avatar

mohit goyal goyalmohit

  • Pune, India
View GitHub Profile
terraform {
required_version = ">= 0.12, < 0.13"
backend "azurerm" {
resource_group_name = "tf-state-rg"
storage_account_name = "tfstatemohit20200930"
container_name = "azure-devops"
key = "terraform.tfstate"
}
provider "azurerm" {
version = "=2.20.0"
features {}
}
resource "azurerm_resource_group" "tf-state-resource-group" {
name = "tf-state-rg"
location = "eastus2"
}
output "azuredevops_project_id" {
value = azuredevops_project.tf-example.id
description = "azure devops project id"
}
output "azuredevops_project_name" {
value = azuredevops_project.tf-example.project_name
description = "azure devops project name"
}
# partially complete block of code below - will not work in isolation
terraform {
required_version = ">= 0.12, < 0.13"
backend "s3" {
bucket = "terrafrom-state-20200929"
key = "azure-devops/terraform.tfstate"
region = "us-east-2"
dynamodb_table = "terraformlocks-mohit-202009292250"
terraform {
required_version = ">= 0.12, < 0.13"
}
provider "aws" {
region = "us-east-2"
}
resource "aws_dynamodb_table" "terraform-locks" {
name = "terraform-locks-mohit-20200929"
terraform {
required_version = ">= 0.12, < 0.13"
}
provider "aws" {
region = "us-east-2"
}
resource "aws_s3_bucket" "terrafrom-state" {
bucket = "terrafrom-state"
# local .terraform directories
**/.terraform/*
# .tfstate files
*.tfstate
*.tfstate.*
# .tfvars files
*.tfvars
variable "service_principal_id" {
description = "Service Principal Id"
type = string
}
variable "service_principal_key" {
description = "Service Principal Password"
type = string
}
# partially complete code block below - will not work in isolation
resource "azuredevops_serviceendpoint_azurerm" "endpointazure" {
project_id = azuredevops_project.tf-example.id
service_endpoint_name = "azurerm_endpoint_test"
description = "Managed by Terraform"
credentials {
serviceprincipalid = var.service_principal_id
serviceprincipalkey = var.service_principal_key
}
# ASP.NET Core (.NET Framework)
# Build and test ASP.NET Core projects targeting the full .NET Framework.
# Add steps that publish symbols, save build artifacts, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core
trigger:
- master
pool:
vmImage: 'windows-latest'