-
-
Save MoimHossain/7230362304ef6988a2c23792e3579259 to your computer and use it in GitHub Desktop.
This file contains 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
package main | |
import ( | |
"github.com/hashicorp/terraform/helper/schema" | |
) | |
// Provider - The top level Azure DevOps Provider definition. | |
func Provider() *schema.Provider { | |
p := &schema.Provider{ | |
ResourcesMap: map[string]*schema.Resource{ | |
"azuredevops_pipeline": resourcePipeline(), | |
"azuredevops_project": resourceProject(), | |
"azuredevops_team": resourceTeam(), | |
"azuredevops_serviceendpoint": resourceServiceEndpoint(), | |
}, | |
Schema: map[string]*schema.Schema{ | |
"org_service_url": { | |
Type: schema.TypeString, | |
Required: true, | |
DefaultFunc: schema.EnvDefaultFunc("AZDO_ORG_SERVICE_URL", nil), | |
Description: "The url of the Azure DevOps instance which should be used.", | |
}, | |
"personal_access_token": { | |
Type: schema.TypeString, | |
Required: true, | |
DefaultFunc: schema.EnvDefaultFunc("AZDO_PERSONAL_ACCESS_TOKEN", nil), | |
Description: "The personal access token which should be used.", | |
}, | |
}, | |
} | |
p.ConfigureFunc = providerConfigure(p) | |
return p | |
} | |
func providerConfigure(p *schema.Provider) schema.ConfigureFunc { | |
return func(d *schema.ResourceData) (interface{}, error) { | |
client, err := getAzdoClient(d.Get("personal_access_token").(string), d.Get("org_service_url").(string)) | |
return client, err | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment