provider "git" {}
data "git_repository" "example" {
path = path.root
}
resource "azurerm_resource_group" "example" {
...
tags = {
branch = data.git_repository.example.branch
commit = substr(data.git_repository.example.commit_sha, 0, 7)
tag = data.git_repository.example.tag
}
}
To build the provider:
$ go build
To test the provider:
$ go test -v ./...
To run all acceptance tests:
Note: Acceptance tests create real resources, and often cost money to run.
$ TF_ACC=1 go test -v ./...
To run a subset of acceptance tests:
$ TF_ACC=1 go test -v ./... -run=TestAccDataSourceGitRepository