blob: 396ad6ce975dc99bed81847ef5d1ee923d48ff9b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
---
layout: "azuredevops"
page_title: "AzureDevops: azuredevops_serviceendpoint_github"
description: |-
Manages a GitHub service endpoint within Azure DevOps organization.
---
# azuredevops_serviceendpoint_github
Manages a GitHub service endpoint within Azure DevOps.
## Example Usage
```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 Personal Access Token"
auth_personal {
# Also can be set with AZDO_GITHUB_SERVICE_CONNECTION_PAT environment variable
personal_access_token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
}
```
```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"
auth_oauth {
oauth_configuration_id = "00000000-0000-0000-0000-000000000000"
}
}
```
```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"
# Note Github Apps do not support a description and will always be empty string. Must be explicitly set to override the default value.
description = "Managed by Terraform"
}
```
## Argument Reference
The following arguments are supported:
- `project_id` - (Required) The ID of the project.
- `service_endpoint_name` - (Required) The Service Endpoint name.
- `description` - (Optional) The Service Endpoint description. Defaults to `Managed by Terraform`.
- `auth_personal` - (Optional) An `auth_personal` block as documented below. Allows connecting using a personal access token.
- `auth_oauth` - (Optional) An `auth_oauth` block as documented below. Allows connecting using an Oauth token.
**NOTE: GitHub Apps can not be created or updated via terraform. You must install and configure the app on GitHub and then import it. You must also set the `description` to "" explicitly."**
`auth_personal` block supports the following:
- `personal_access_token` - (Required) The Personal Access Token for GitHub.
`auth_oauth` block supports the following:
- `oauth_configuration_id` - (Required) **NOTE: GitHub OAuth flow can not be performed via terraform. You must create this on Azure DevOps and then import it.** The OAuth Configuration ID.
## Attributes Reference
The following attributes are exported:
- `id` - The ID of the service endpoint.
- `project_id` - The ID of the project.
- `service_endpoint_name` - The Service Endpoint name.
## Relevant Links
- [Azure DevOps Service REST API 6.0 - Service Endpoints](https://docs.microsoft.com/en-us/rest/api/azure/devops/serviceendpoint/endpoints?view=azure-devops-rest-6.0)
## Import
Azure DevOps Service Endpoint GitHub can be imported using **projectID/serviceEndpointID** or **projectName/serviceEndpointID**
```sh
terraform import azuredevops_serviceendpoint_github.example 00000000-0000-0000-0000-000000000000/00000000-0000-0000-0000-000000000000
```
|