|
1 |
| -# Terraform Provider Stack Overflow |
| 1 | +# Terraform Provider for Stack Overflow |
2 | 2 |
|
3 |
| -Run the following command to build the provider |
| 3 | +The Terraform Provider for Stack Overflow is a Terraform plugin provider that allows you to manage questions, answers, and articles for your Stack Overflow for Teams. |
4 | 4 |
|
5 |
| -```powershell |
6 |
| -# Windows |
7 |
| -go build -o terraform-provider-stackoverflow.exe |
8 |
| -cp terraform-provider-stackoverflow.exe ~/go/bin |
9 |
| -``` |
| 5 | +## Using the Provider |
| 6 | +--------------------- |
10 | 7 |
|
11 |
| -Create a `terraform.rc` file in the %APPDATA% directory. |
| 8 | +To use a released version of the Terraform provider in your environment, run `terraform init` and Terraform will automatically install the provider from the Terraform Registry. To specify a particular provider version when installing released providers, see the [Terraform documentation on provider versioning](https://www.terraform.io/docs/configuration/providers.html#version-provider-versions). |
12 | 9 |
|
13 |
| -```powershell |
14 |
| -cd $env:APPDATA |
15 |
| -mk terraform.rc |
16 |
| -``` |
| 10 | +## Example |
| 11 | +---------- |
17 | 12 |
|
18 |
| -Add the following content to the `terraform.rc` file: |
| 13 | +```terraform |
| 14 | +provider "stackoverflow" { |
| 15 | + team_name = "my-team-name" |
| 16 | + access_token = "xxxx" |
| 17 | + default_tags = ["terraform"] |
| 18 | +} |
19 | 19 |
|
20 |
| -``` |
21 |
| -provider_installation { |
22 |
| - dev_overrides { |
23 |
| - "registry.terraform.io/hashicorp/stackoverflow" = "C:/Users/rbolhofer/go/bin" |
24 |
| - } |
25 |
| - direct {} |
| 20 | +resource "stackoverflow_filter" "filter" { |
26 | 21 | }
|
27 |
| -``` |
28 | 22 |
|
29 |
| -## Test sample configuration |
| 23 | +resource "stackoverflow_article" "article" { |
| 24 | + article_type = "announcement" |
| 25 | + title = "Terraform Provider for Stack Overflow is available!" |
| 26 | + body_markdown = "Look for the Stack Overflow provider in the Terraform registry" |
| 27 | + tags = ["example"] |
| 28 | + filter = stackoverflow_filter.filter.id |
| 29 | +} |
30 | 30 |
|
31 |
| -In a new directory, create a file named `main.tf` and add the following content: |
| 31 | +resource "stackoverflow_question" "question" { |
| 32 | + title = "Stack Overflow Terraform Provider" |
| 33 | + body_markdown = "What is the Terraform Provider for Stack Overflow?" |
| 34 | + tags = ["example"] |
| 35 | + filter = stackoverflow_filter.filter.id |
| 36 | +} |
32 | 37 |
|
33 |
| -``` |
34 |
| -resource "stackoverflow_article" "test_article" { |
35 |
| - article_type = "knowledge-article" |
36 |
| - title = "Test Article" |
37 |
| - body_markdown = "# Hello World" |
38 |
| - tags = ["test"] |
| 38 | +resource "stackoverflow_answer" "answer" { |
| 39 | + question_id = stackoverflow_question.question.id |
| 40 | + body_markdown = "It is a Terraform plugin provider to manage resources in Stack Overflow for Teams" |
| 41 | + filter = stackoverflow_filter.filter.id |
39 | 42 | }
|
40 | 43 | ```
|
41 |
| - |
42 |
| -Then initialize and run Terraform: |
43 |
| - |
44 |
| -```powershell |
45 |
| -terraform init |
46 |
| -terraform plan -out terraform.tfplan |
47 |
| -``` |
0 commit comments