### Install Golang Color Library Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/vendor/github.com/fatih/color/README.md Use 'go get' to install the color library. ```bash go get github.com/fatih/color ``` -------------------------------- ### Install go-isatty Package Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/vendor/github.com/mattn/go-isatty/README.md Install the go-isatty package using the go get command. ```bash go get github.com/mattn/go-isatty ``` -------------------------------- ### Install go-version Library Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/vendor/github.com/hashicorp/go-version/README.md Use 'go get' to install the go-version library for use in your Go projects. ```bash $ go get github.com/hashicorp/go-version ``` -------------------------------- ### Install msgpack/v5 Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/vendor/github.com/vmihailenco/msgpack/v5/README.md Install the msgpack/v5 library using go get. Ensure you are using Go modules and have initialized your project with `go mod init`. ```shell go mod init github.com/my/repo ``` ```shell go get github.com/vmihailenco/msgpack/v5 ``` -------------------------------- ### Install go-linq Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/vendor/github.com/ahmetb/go-linq/README.md Use 'go get' to install the go-linq package. Dependency managers like govendor or godep are recommended for managing local copies. ```bash $ go get github.com/ahmetalpbalkan/go-linq ``` -------------------------------- ### Install copystructure Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/vendor/github.com/mitchellh/copystructure/README.md Use `go get` to install the copystructure library. This is the standard method for obtaining Go packages. ```bash go get github.com/mitchellh/copystructure ``` -------------------------------- ### Install mapstructure Go Library Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/vendor/github.com/mitchellh/mapstructure/README.md Use the standard 'go get' command to install the mapstructure library. ```bash go get github.com/mitchellh/mapstructure ``` -------------------------------- ### Install MessagePack Package Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/vendor/github.com/vmihailenco/msgpack/README.md Use 'go get' to install the latest version of the msgpack package. ```shell go get -u github.com/vmihailenco/msgpack ``` -------------------------------- ### Install Golang Tag Parser v2 Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/vendor/github.com/vmihailenco/tagparser/v2/README.md Use 'go get' to install the tagparser library. ```shell go get github.com/vmihailenco/tagparser/v2 ``` -------------------------------- ### Install UUID Package Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/vendor/github.com/google/uuid/README.md Use 'go get' to install the UUID package. This command fetches and installs the package into your Go workspace. ```sh go get github.com/google/uuid ``` -------------------------------- ### Install Extension Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/website/docs/r/extension.html.markdown This example demonstrates how to install an Azure DevOps extension using the `azuredevops_extension` resource. You need to provide the `extension_id` and `publisher_id`. ```APIDOC ## Install Extension ### Description Installs an Azure DevOps extension into your organization. ### Resource `azuredevops_extension` ### Arguments * `extension_id` - (Required) The Azure DevOps Marketplace extension identifier (e.g., `vss-code-search`). * `publisher_id` - (Required) The Azure DevOps Marketplace publisher identifier (e.g., `ms`). * `disabled` - (Optional) Whether to disable the extension. * `version` - (Optional) The version of the extension to install. ### Example ```hcl resource "azuredevops_extension" "example" { extension_id = "extension ID" publisher_id = "publisher ID" } ``` ``` -------------------------------- ### Installer Methods Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/vendor/github.com/hashicorp/hc-install/README.md The Installer object provides high-level methods for managing HashiCorp binary installations. These methods allow users to ensure a specific version is available, or to install a product version. ```APIDOC ## Installer Methods ### `Ensure(context.Context, []src.Source)` #### Description Ensures a specific product version is available by finding, installing, or building it. ### `Install(context.Context, []src.Installable)` #### Description Installs a specified product version. ``` -------------------------------- ### CLI Installation Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/vendor/github.com/hashicorp/hc-install/README.md Instructions for installing the `hc-install` command-line utility. ```APIDOC ## CLI Installation ### Homebrew (macOS / Linux) ```sh brew install hashicorp/tap/hc-install ``` ### Linux (Debian/Ubuntu/RHEL/CentOS/Fedora/Amazon Linux) Follow the instructions in the [Official Packaging Guide](https://www.hashicorp.com/official-packaging-guide) to install the `hc-install` package from the official HashiCorp-maintained repositories. ``` -------------------------------- ### Installation Confirmation Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/vendor/github.com/hashicorp/hc-install/README.md This output indicates a successful installation of a HashiCorp product and its version, along with the installation path. ```text hc-install: will install terraform@1.3.7 installed terraform@1.3.7 to /current/working/dir/terraform ``` -------------------------------- ### Build Script Output Example Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/docs/contributing.md Example output from the build script indicating successful execution of unit tests and compilation. ```bash $ ./scripts/build.sh ... [INFO] Executing unit tests ... [INFO] Build finished successfully ``` -------------------------------- ### Install go-colorable Package Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/vendor/github.com/mattn/go-colorable/README.md This command installs the go-colorable package using the Go toolchain. Ensure you have Go installed and configured correctly. ```bash $ go get github.com/mattn/go-colorable ``` -------------------------------- ### Build and Install Terraform Provider Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/docs/contributing.md Use 'make install' to build and locally install the provider. This command orchestrates dependency verification, unit tests, and compilation. ```bash $ make install ``` -------------------------------- ### Install a HashiCorp Product Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/vendor/github.com/hashicorp/hc-install/README.md Use this command to install a specific version of a HashiCorp product. The product will be installed in the current working directory by default. ```sh hc-install install -version 1.3.7 terraform ``` -------------------------------- ### Get AzureDevops Git Repository File Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/website/docs/d/git_repository_file.html.markdown This example demonstrates how to fetch a specific file from a Git repository. It first retrieves the project and repository details, then uses those to specify the target file and branch for the data source. ```hcl data "azuredevops_project" "example" { name = "Example Project" } # Load a specific Git repository by name data "azuredevops_git_repository" "example" { project_id = data.azuredevops_project.example.id name = "Example Repository" } data "azuredevops_git_repository_file" "example" { repository_id = data.azuredevops_git_repository.example.id branch = "refs/heads/main" file = "MyFile.txt" } ``` -------------------------------- ### Integer List Example Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/website/docs/r/workitemtrackingprocess_list.html.markdown Example of creating an integer-based list for work item tracking processes. ```APIDOC ## Resource: azuredevops_workitemtrackingprocess_list ### Description Manages an organization-scoped list for work item tracking processes. ### Arguments Reference * `name` - (Required) Name of the list. * `items` - (Required) A list of items. * `type` - (Optional) Data type of the list. Valid values: `string`, `integer`. Defaults to `string`. * `is_suggested` - (Optional) Indicates whether items outside of the suggested list are allowed. Defaults to `false`. ### Attributes Reference * `id` - The ID of the list. * `url` - URL of the list. ### Example Usage ```hcl resource "azuredevops_workitemtrackingprocess_list" "example" { name = "Story Points" type = "integer" items = ["1", "2", "3", "5", "8", "13", "21"] } ``` ``` -------------------------------- ### String List Example Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/website/docs/r/workitemtrackingprocess_list.html.markdown Example of creating a string-based list for work item tracking processes. ```APIDOC ## Resource: azuredevops_workitemtrackingprocess_list ### Description Manages an organization-scoped list for work item tracking processes. ### Arguments Reference * `name` - (Required) Name of the list. * `items` - (Required) A list of items. * `type` - (Optional) Data type of the list. Valid values: `string`, `integer`. Defaults to `string`. * `is_suggested` - (Optional) Indicates whether items outside of the suggested list are allowed. Defaults to `false`. ### Attributes Reference * `id` - The ID of the list. * `url` - URL of the list. ### Example Usage ```hcl resource "azuredevops_workitemtrackingprocess_list" "example" { name = "Priority Levels" items = ["Low", "Medium", "High", "Critical"] } ``` ``` -------------------------------- ### Source Types for Installer Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/vendor/github.com/hashicorp/hc-install/README.md The Installer methods accept various Source types, each with different trade-offs regarding convenience, reliability, and resource consumption. ```APIDOC ## Source Types ### `fs.{AnyVersion,ExactVersion,Version}` #### Description Finds a binary in `$PATH` or additional specified paths. #### Pros - Convenient when the product is already installed and managed by the user. #### Cons - Relies on a single version; user must manage installation. - Not recommended for environments where product installation is not controlled by the user (e.g., default GitHub Actions images). ### `releases.{LatestVersion,ExactVersion}` #### Description Downloads, verifies, and installs any known product from `releases.hashicorp.com`. #### Pros - Fast and reliable for obtaining pre-built versions. - Allows installation of enterprise versions. #### Cons - Consumes bandwidth, disk space, and time. - Potentially less stable builds compared to Checkpoint. ### `checkpoint.LatestVersion` #### Description Downloads, verifies, and installs any known product available in HashiCorp Checkpoint. #### Pros - Checkpoint typically contains only stable product versions. #### Cons - Consumes bandwidth, disk space, and time. - Currently does not support installation of old or enterprise versions. ### `build.GitRevision` #### Description Clones raw source code and builds the product from it. #### Pros - Useful for catching bugs and incompatibilities early (pre-release). #### Cons - Building from scratch is resource-intensive (CPU, memory, bandwidth, disk space). - Build instructions may not always be up-to-date. - Increased likelihood of build containing bugs prior to release. - CI builds relying on this can be fragile. ``` -------------------------------- ### Install the Azure Identity Module Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/README.md Installs the Azure Identity module using Go modules for versioning and dependency management. ```sh go get -u github.com/Azure/azure-sdk-for-go/sdk/azidentity ``` -------------------------------- ### Install Levenshtein Package Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/vendor/github.com/agext/levenshtein/README.md Use this command to add the Levenshtein package to your Go project. ```go go get github.com/agext/levenshtein ``` -------------------------------- ### Importing a Repository File Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/website/docs/r/git_repository_file.html.markdown These examples demonstrate how to import an existing repository file into Terraform state. The first example shows a standard import for a file on the master branch. The second example illustrates how to import a file from a specific branch by appending the branch name. ```sh terraform import azuredevops_git_repository_file.example 00000000-0000-0000-0000-000000000000/.gitignore ``` ```sh terraform import azuredevops_git_repository_file.example 00000000-0000-0000-0000-000000000000/.gitignore:refs/heads/master ``` -------------------------------- ### Quickstart: Parse a Tag String Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/vendor/github.com/vmihailenco/tagparser/v2/README.md Demonstrates parsing a string with a name and key-value options into a Tag object. The parsed name and options map are printed. ```go func ExampleParse() { tag := tagparser.Parse("some_name,key:value,key2:'complex value'") fmt.Println(tag.Name) fmt.Println(tag.Options) // Output: // some_name // map[key:value key2:'complex value'] } ``` -------------------------------- ### Quickstart: Marshal and Unmarshal Data Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/vendor/github.com/vmihailenco/msgpack/README.md Demonstrates basic usage of Marshal and Unmarshal to encode and decode a struct. Ensure error handling for production code. ```go func ExampleMarshal() { type Item struct { Foo string } b, err := msgpack.Marshal(&Item{Foo: "bar"}) if err != nil { panic(err) } var item Item err = msgpack.Unmarshal(b, &item) if err != nil { panic(err) } fmt.Println(item.Foo) // Output: bar } ``` -------------------------------- ### Setup Development Workspace Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/docs/contributing.md Create and navigate to a dedicated directory for development. Assumes bash environment. ```bash $ DEV_ROOT="$HOME/workspace" $ mkdir -p "$DEV_ROOT" $ cd "$DEV_ROOT" ``` -------------------------------- ### Build All Files (Old System) Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/vendor/golang.org/x/sys/unix/README.md Builds Go files for the current OS and architecture using the old build system. Ensure GOOS and GOARCH are set correctly. Running `mkall.sh -n` shows the commands that will be run. ```bash mkall.sh ``` -------------------------------- ### Get Docker Registry Service Endpoint by Name Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/website/docs/d/serviceendpoint_dockerregistry.html.markdown This example shows how to retrieve a Docker Registry Service Endpoint by its name within a specified project. ```APIDOC ## Data Source: azuredevops_serviceendpoint_dockerregistry Use this data source to access information about an existing Docker Registry Service Endpoint. ### Example Usage #### By Service Endpoint Name ```hcl data "azuredevops_project" "example" { name = "Example Project" } data "azuredevops_serviceendpoint_dockerregistry" "example" { project_id = data.azuredevops_project.example.id service_endpoint_name = "Example-Service-Endpoint" } output "service_endpoint_id" { value = data.azuredevops_serviceendpoint_dockerregistry.example.id } ``` ## Arguments Reference The following arguments are supported: * `project_id` - (Required) The ID of the project. * `service_endpoint_name` - the Name of the Service Endpoint. ~> **NOTE:** One of either `service_endpoint_id` or `service_endpoint_name` must be specified.
2. When supplying `service_endpoint_name`, take care to ensure that this is a unique name. ## Attributes Reference In addition to the Arguments list above - the following Attributes are exported: * `id` - The ID of the Azure Resource Manager Service Endpoint. * `authorization` - The Authorization scheme. * `description` - The Service Endpoint description. * `docker_registry` - The URL of the Docker registry. * `docker_username` - The identifier of the Docker account user. * `docker_email` - The email for Docker account user. * `docker_password` - The password for the account user identified above. * `registry_type` - Can be "DockerHub" or "Others" (Default "DockerHub") ## Timeouts The `timeouts` block allows you to specify [timeouts](https://developer.hashicorp.com/terraform/language/resources/syntax#operation-timeouts) for certain actions: * `read` - (Defaults to 5 minute) Used when retrieving the Azure Resource Manager Service Endpoint. ``` -------------------------------- ### Create ArgoCD Service Endpoint with Token Authentication Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/website/docs/r/serviceendpoint_argocd.html.markdown Example of creating an ArgoCD service endpoint using a token for authentication. Ensure the Argo CD Extension is installed. ```hcl resource "azuredevops_project" "example" { name = "Example Project" visibility = "private" version_control = "Git" work_item_template = "Agile" } resource "azuredevops_serviceendpoint_argocd" "example" { project_id = azuredevops_project.example.id service_endpoint_name = "Example ArgoCD" description = "Managed by Terraform" url = "https://argocd.my.com" authentication_token { token = "0000000000000000000000000000000000000000" } } ``` -------------------------------- ### Get Docker Registry Service Endpoint by ID Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/website/docs/d/serviceendpoint_dockerregistry.html.markdown This example demonstrates how to retrieve a Docker Registry Service Endpoint using its unique ID within a specified project. ```APIDOC ## Data Source: azuredevops_serviceendpoint_dockerregistry Use this data source to access information about an existing Docker Registry Service Endpoint. ### Example Usage #### By Service Endpoint ID ```hcl data "azuredevops_project" "example" { name = "Example Project" } data "azuredevops_serviceendpoint_dockerregistry" "example" { project_id = data.azuredevops_project.example.id service_endpoint_id = "00000000-0000-0000-0000-000000000000" } output "service_endpoint_name" { value = data.azuredevops_serviceendpoint_dockerregistry.example.service_endpoint_name } ``` ## Arguments Reference The following arguments are supported: * `project_id` - (Required) The ID of the project. * `service_endpoint_id` - the ID of the Service Endpoint. ~> **NOTE:** One of either `service_endpoint_id` or `service_endpoint_name` must be specified. ## Attributes Reference In addition to the Arguments list above - the following Attributes are exported: * `id` - The ID of the Azure Resource Manager Service Endpoint. * `authorization` - The Authorization scheme. * `description` - The Service Endpoint description. * `docker_registry` - The URL of the Docker registry. * `docker_username` - The identifier of the Docker account user. * `docker_email` - The email for Docker account user. * `docker_password` - The password for the account user identified above. * `registry_type` - Can be "DockerHub" or "Others" (Default "DockerHub") ## Timeouts The `timeouts` block allows you to specify [timeouts](https://developer.hashicorp.com/terraform/language/resources/syntax#operation-timeouts) for certain actions: * `read` - (Defaults to 5 minute) Used when retrieving the Azure Resource Manager Service Endpoint. ``` -------------------------------- ### Get Bitbucket Service Endpoint by Name Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/website/docs/d/serviceendpoint_bitbucket.html.markdown This example demonstrates how to retrieve a Bitbucket service endpoint by its name. It requires the project ID and a unique service endpoint name. ```hcl data "azuredevops_project" "example" { name = "Example Project" } data "azuredevops_serviceendpoint_bitbucket" "example" { project_id = data.azuredevops_project.example.id service_endpoint_name = "Example" } output "service_endpoint_id" { value = data.azuredevops_serviceendpoint_bitbucket.example.id } ``` -------------------------------- ### Get Docker Registry Service Endpoint by Name Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/website/docs/d/serviceendpoint_dockerregistry.html.markdown This example demonstrates how to fetch a Docker Registry Service Endpoint by its name. It requires the project ID and the unique service endpoint name. ```hcl data "azuredevops_project" "example" { name = "Example Project" } data "azuredevops_serviceendpoint_dockerregistry" "example" { project_id = data.azuredevops_project.example.id service_endpoint_name = "Example-Service-Endpoint" } output "service_endpoint_id" { value = data.azuredevops_serviceendpoint_dockerregistry.serviceendpoint.id } ``` -------------------------------- ### Show Build Commands (Old System) Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/vendor/golang.org/x/sys/unix/README.md Displays the commands that will be run by `mkall.sh` without executing them, useful for understanding the build process of the old system. ```bash mkall.sh -n ``` -------------------------------- ### Get Docker Registry Service Endpoint by ID Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/website/docs/d/serviceendpoint_dockerregistry.html.markdown Use this example to retrieve a Docker Registry Service Endpoint using its unique ID. Ensure the project ID is correctly specified. ```hcl data "azuredevops_project" "example" { name = "Example Project" } data "azuredevops_serviceendpoint_dockerregistry" "example" { project_id = data.azuredevops_project.example.id service_endpoint_id = "00000000-0000-0000-0000-000000000000" } output "service_endpoint_name" { value = data.azuredevops_serviceendpoint_dockerregistry.example.service_endpoint_name } ``` -------------------------------- ### Initialize Terraform Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/docs/contributing.md Initialize the Terraform working directory. This downloads the necessary provider plugins and sets up the backend. ```bash $ terraform init ... Terraform has been successfully initialized! ... ``` -------------------------------- ### Resolve Ambiguous Provider Address using cURL Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/vendor/github.com/hashicorp/terraform-registry-address/README.md Use `curl` to query the Terraform Registry API for provider versions and resolve ambiguous addresses. This example shows how to get the fully qualified address for 'grafana' and 'aws'. ```sh # grafana (redirected to its own namespace) $ curl -s https://registry.terraform.io/v1/providers/-/grafana/versions | jq '(.id, .moved_to)' "terraform-providers/grafana" "grafana/grafana" # aws (provider without redirection) $ curl -s https://registry.terraform.io/v1/providers/-/aws/versions | jq '(.id, .moved_to)' "hashicorp/aws" null ``` -------------------------------- ### Create JFrog XRay V2 Service Endpoint with Basic Authentication Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/website/docs/r/serviceendpoint_jfrog_xray_v2.html.markdown This example demonstrates creating a JFrog XRay V2 service endpoint using username and password authentication. The JFrog Extension must be installed in your Azure DevOps organization. ```hcl resource "azuredevops_project" "example" { name = "Example Project" visibility = "private" version_control = "Git" work_item_template = "Agile" description = "Managed by Terraform" } resource "azuredevops_serviceendpoint_jfrog_xray_v2" "example" { project_id = azuredevops_project.example.id service_endpoint_name = "Example Artifactory" description = "Managed by Terraform" url = "https://artifactory.my.com" authentication_basic { username = "username" password = "password" } } ``` -------------------------------- ### Create a GitHub Service Endpoint for GitHub Apps Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/website/docs/r/serviceendpoint_github.html.markdown This example shows how to configure a GitHub service endpoint, specifically for GitHub Apps. Note that GitHub Apps cannot be created or updated via Terraform and must be installed and configured on GitHub first. The description must be explicitly set to an empty string. ```APIDOC ## Create GitHub Service Endpoint for GitHub Apps ### Description Configures a GitHub service endpoint for GitHub Apps. Note that GitHub Apps must be pre-installed and configured on GitHub. The description field must be explicitly set to an empty string. ### Method `resource "azuredevops_serviceendpoint_github" "example"` ### Parameters #### Path Parameters - `project_id` (string) - Required - The ID of the project. - `service_endpoint_name` (string) - Required - The Service Endpoint name. #### Request Body - `description` (string) - Required - The Service Endpoint description. Must be an empty string for GitHub Apps. ### Request Example ```hcl resource "azuredevops_project" "example" { name = "Example Project" visibility = "private" version_control = "Git" work_item_template = "Agile" description = "Managed by Terraform" } resource "azuredevops_serviceendpoint_github" "example" { project_id = azuredevops_project.example.id service_endpoint_name = "Example GitHub Apps: Azure Pipelines" description = "" } ``` ### Response #### Success Response (200) - `id` (string) - The ID of the service endpoint. - `project_id` (string) - The ID of the project. - `service_endpoint_name` (string) - The Service Endpoint name. #### Response Example (Response details not explicitly provided in source, but would typically include the created endpoint's ID and configuration.) ``` -------------------------------- ### Execute Compiled Provider Directly (Not Recommended) Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/docs/contributing.md Attempting to run the provider binary directly will result in a message indicating it's a plugin and not meant for direct execution. ```bash $ ./bin/terraform-provider-azuredevops_v0.0.1 This binary is a plugin. These are not meant to be executed directly. Please execute the program that consumes these plugins, which will load any plugins automatically ``` -------------------------------- ### Go Semantic Versioning Import Example Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/vendor/github.com/hashicorp/hcl/v2/README.md Demonstrates how to import both HCL v1 and v2 into a Go program using semantic versioning. ```go import ( hcl1 "github.com/hashicorp/hcl" hcl2 "github.com/hashicorp/hcl/v2" ) ``` -------------------------------- ### Install gRPC-Go Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/vendor/google.golang.org/grpc/README.md Add this import to your Go code to automatically fetch gRPC-Go dependencies during build, run, or test. ```go import "google.golang.org/grpc" ``` -------------------------------- ### Manage Project-level Permissions Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/website/docs/r/security_permissions.html.markdown This example demonstrates how to manage permissions for a specific project. It involves retrieving project details, the project's security namespace token, and the target group's descriptor. ```hcl data "azuredevops_project" "example" { name = "Example Project" } data "azuredevops_security_namespace_token" "project" { namespace_name = "Project" identifiers = { project_id = data.azuredevops_project.example.id } } data "azuredevops_group" "example_readers" { project_id = data.azuredevops_project.example.id name = "Readers" } data "azuredevops_namespace" "project" { name = "Project" } resource "azuredevops_security_permissions" "project_perms" { namespace_id = data.azuredevops_namespace.project.id token = data.azuredevops_security_namespace_token.project.token principal = data.azuredevops_group.example_readers.descriptor permissions = { "GENERIC_READ" = "allow" "GENERIC_WRITE" = "deny" "DELETE" = "deny" } } ``` -------------------------------- ### Install Xcode Command Line Tools Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/docs/debugging.md On macOS, if you encounter issues with debugging tools, you may need to install the Xcode Command Line Tools. This command installs the necessary components. ```bash % xcode-select --install ``` -------------------------------- ### Basic Word Wrapping Example Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/vendor/github.com/mitchellh/go-wordwrap/README.md Demonstrates basic usage of the WrapString function to wrap a string to a specified width. This is useful for formatting command-line interface output. ```go wrapped := wordwrap.WrapString("foo bar baz", 3) fmt.Println(wrapped) ``` -------------------------------- ### HCL Native Syntax Example Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/vendor/github.com/hashicorp/hcl/v2/README.md Illustrates the native HCL syntax with attributes and nested blocks for defining a service configuration. ```hcl io_mode = "async" service "http" "web_proxy" { listen_addr = "127.0.0.1:8080" process "main" { command = ["/usr/local/bin/awesome-app", "server"] } process "mgmt" { command = ["/usr/local/bin/awesome-app", "mgmt"] } } ``` -------------------------------- ### Install hc-install via Homebrew Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/vendor/github.com/hashicorp/hc-install/README.md Installs the hc-install CLI using Homebrew on macOS or Linux systems. ```sh brew install hashicorp/tap/hc-install ``` -------------------------------- ### Enable Datastore Key Conversion for Automatic Scaling Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/vendor/google.golang.org/appengine/README.md For automatic scaling, where /_ah/start is not supported, call datastore.EnableKeyConversion before using code that requires key conversion. EnableKeyConversion is safe for concurrent use and subsequent calls are ignored. ```go datastore.EnableKeyConversion(appengine.NewContext(r)) ``` -------------------------------- ### Import an existing Git repository Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/website/docs/r/git_repository.html.markdown This example demonstrates how to import an existing Git repository from a private source, using either a service connection or username/password for authentication. ```APIDOC ## Import from a Private Repository ### Description Allows importing an existing Git repository from a private source. Requires either a `service_connection_id` or `username` and `password` for authentication. ### Argument Reference for Initialization Block A `initialization` block supports the following: * `init_type` - (Required) Set to `Import`. * `source_type` - (Optional) Set to `Git`. * `source_url` - (Required) The URL of the source repository. * `service_connection_id` - (Optional) The ID of service connection used to authenticate to a private repository for import initialization. Conflicts with `username` and `password`. * `username` - (Optional) The username used to authenticate to a private repository for import initialization. Conflicts with `service_connection_id`. * `password` - (Optional) The password used to authenticate to a private repository for import initialization. Conflicts with `service_connection_id`. Note: This is a write-only attribute. ~>**Note** At least `service_connection_id` or `username/password` needs to be set to import private repository. ### Example with Service Connection ```hcl resource "azuredevops_git_repository" "example-import" { project_id = azuredevops_project.example.id name = "Example Import Existing Repository" initialization { init_type = "Import" source_type = "Git" source_url = "https://dev.azure.com/example-org/private-repository.git" service_connection_id = azuredevops_serviceendpoint_generic_git.example-serviceendpoint.id } } ``` ### Example with Username/Password ```hcl resource "azuredevops_git_repository" "example-import2" { project_id = azuredevops_project.example.id name = "Example Import Existing Repository" initialization { init_type = "Import" source_type = "Git" source_url = "https://dev.azure.com/example-org/private-repository.git" username = "username" password = "password" } } ``` ``` -------------------------------- ### Enable Datastore Key Conversion for Basic/Manual Scaling Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/vendor/google.golang.org/appengine/README.md Enable key conversion for all handlers by calling EnableKeyConversion in the /_ah/start handler. This is suitable for basic and manual scaling environments. ```go http.HandleFunc("/_ah/start", func(w http.ResponseWriter, r *http.Request) { datastore.EnableKeyConversion(appengine.NewContext(r)) }) ``` -------------------------------- ### Build Completed Event with Authentication Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/website/docs/r/servicehook_webhook_tfs.markdown This example shows how to set up a webhook for build completion events, including basic authentication credentials and SSL certificate validation settings. ```APIDOC ## Build Completed Event with Authentication ### Description This configuration triggers the webhook when a build completes, with options for basic authentication and SSL certificate handling. ### Arguments * `project_id` - (Required) The ID of the project. * `url` - (Required) The URL to send HTTP POST to. * `basic_auth_username` - (Optional) Basic authentication username. * `basic_auth_password` - (Optional) Basic authentication password. * `accept_untrusted_certs` - (Optional) Accept untrusted SSL certificates. Defaults to `false`. * `build_completed` - (Optional) A block to configure the build completed event trigger. * `definition_name` - (Optional) The name of the build definition. * `build_status` - (Optional) The status of the build (e.g., `Succeeded`, `Failed`). ### Request Example ```hcl resource "azuredevops_servicehook_webhook_tfs" "example" { project_id = azuredevops_project.example.id url = "https://example.com/webhook" basic_auth_username = "webhook_user" basic_auth_password = var.webhook_password accept_untrusted_certs = false build_completed { definition_name = "CI Build" build_status = "Succeeded" } } ``` ``` -------------------------------- ### Install and Update JWT Go Library v4 Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/vendor/github.com/golang-jwt/jwt/v5/MIGRATION_GUIDE.md Commands to install the v4 of the golang-jwt library and update the go module dependencies. ```bash go get github.com/golang-jwt/jwt/v4 go mod tidy ``` -------------------------------- ### Example Work Item Query Permissions Configuration Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/website/docs/r/workitemquery_permissions.html.markdown Demonstrates setting permissions for both project-level and shared queries folder levels. The `replace` argument defaults to `true`, meaning new permissions will overwrite existing ones. ```hcl resource "azuredevops_project" "example" { name = "Example Project" work_item_template = "Agile" version_control = "Git" visibility = "private" description = "Managed by Terraform" } data "azuredevops_group" "example-readers" { project_id = azuredevops_project.example.id name = "Readers" } data "azuredevops_group" "example-contributors" { project_id = azuredevops_project.example.id name = "Contributors" } resource "azuredevops_workitemquery_permissions" "example-project-permissions" { project_id = azuredevops_project.example.id principal = data.azuredevops_group.example-readers.id permissions = { Read = "Allow" Delete = "Deny" Contribute = "Deny" ManagePermissions = "Deny" } } resource "azuredevops_workitemquery_permissions" "example-sharedqueries-permissions" { project_id = azuredevops_project.example.id path = "/" principal = data.azuredevops_group.example-contributors.id permissions = { Read = "Allow" Delete = "Deny" } } ``` -------------------------------- ### Configure Go Environment for Go 1.13+ Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/docs/contributing.md Run these commands if you encounter module verification errors with Go 1.13+. This configures the Go proxy and checksum database. ```bash go env -w GOPROXY=direct go env -w GOSUMDB=off ``` -------------------------------- ### Build and Install Provider Locally Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/README.md Commands to build and locally install the Azure DevOps Terraform provider. These commands will sideload the plugin for Terraform. ```sh $ make build ... $ $GOPATH/bin/terraform-provider-azuredevops ... ``` -------------------------------- ### Yamux Client Usage Source: https://github.com/microsoft/terraform-provider-azuredevops/blob/main/vendor/github.com/hashicorp/yamux/README.md Demonstrates how to set up a Yamux client session over a TCP connection and open a new stream for communication. ```go func client() { // Get a TCP connection conn, err := net.Dial(...) if err != nil { panic(err) } // Setup client side of yamux session, err := yamux.Client(conn, nil) if err != nil { panic(err) } // Open a new stream stream, err := session.Open() if err != nil { panic(err) } // Stream implements net.Conn stream.Write([]byte("ping")) } ```