Created
April 3, 2022 06:04
-
-
Save danielplawgo/9a20a0b0db15305f4840aa7845852c4b to your computer and use it in GitHub Desktop.
Uruchamianie Terraform w Azure DevOps
This file contains hidden or 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
trigger: | |
- main | |
pool: | |
vmImage: ubuntu-latest | |
steps: | |
- task: PublishBuildArtifacts@1 | |
inputs: | |
PathtoPublish: '$(Build.Repository.LocalPath)/src' | |
ArtifactName: 'drop' | |
publishLocation: 'Container' |
This file contains hidden or 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
steps: | |
- task: ms-devlabs.custom-terraform-tasks.custom-terraform-installer-task.TerraformInstaller@0 | |
displayName: 'Install Terraform' | |
inputs: | |
terraformVersion: 1.1.7 |
This file contains hidden or 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
terraform { | |
required_providers { | |
azurerm = { | |
source = "hashicorp/azurerm" | |
version = ">= 2.63" | |
} | |
} | |
backend "azurerm" { | |
} | |
required_version = ">= 0.14.9" | |
} |
This file contains hidden or 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
terraform { | |
backend "azurerm" { | |
resource_group_name = "StorageAccount-ResourceGroup" | |
storage_account_name = "tfstates" | |
container_name = "tfstates" | |
key = "prod.tfstate" | |
} | |
} |
This file contains hidden or 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
steps: | |
- task: qetza.replacetokens.replacetokens-task.replacetokens@4 | |
displayName: 'Replace tokens in **/*.tf' | |
inputs: | |
rootDirectory: '$(System.DefaultWorkingDirectory)/_TerraformAzure/drop' | |
targetFiles: '**/*.tf' | |
tokenPattern: rm |
This file contains hidden or 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
steps: | |
- task: ms-devlabs.custom-terraform-tasks.custom-terraform-release-task.TerraformTaskV2@2 | |
displayName: 'Terraform : azurerm validate and apply' | |
inputs: | |
command: apply | |
workingDirectory: '$(System.DefaultWorkingDirectory)/_TerraformAzure/drop' | |
commandOptions: '-auto-approve' | |
environmentServiceNameAzureRM: 'Subskrypcja platformy Azure' | |
This file contains hidden or 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
steps: | |
- task: ms-devlabs.custom-terraform-tasks.custom-terraform-release-task.TerraformTaskV2@2 | |
displayName: 'Terraform : azurerm init' | |
inputs: | |
workingDirectory: '$(System.DefaultWorkingDirectory)/_TerraformAzure/drop' | |
backendServiceArm: 'Subskrypcja platformy Azure' | |
backendAzureRmResourceGroupName: 'terraform-config' | |
backendAzureRmStorageAccountName: plawgoterraformazured | |
backendAzureRmContainerName: terraform | |
backendAzureRmKey: test.ftstate |
This file contains hidden or 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
variable "env" { | |
type = string | |
default = "__env__" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment