Skip to content

Commit

Permalink
Implement provider configuration
Browse files Browse the repository at this point in the history
Left the pipeline and project resources only
  • Loading branch information
palson-cf committed May 18, 2020
1 parent 4557dcc commit 17d4c61
Show file tree
Hide file tree
Showing 9 changed files with 107 additions and 717 deletions.
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ github.com/hashicorp/terraform-config-inspect v0.0.0-20191212124732-c6ae6269b9d7
github.com/hashicorp/terraform-json v0.4.0/go.mod h1:eAbqb4w0pSlRmdvl8fOyHAi/+8jnkVYN28gJkSJrLhU=
github.com/hashicorp/terraform-plugin-sdk v1.7.0 h1:B//oq0ZORG+EkVrIJy0uPGSonvmXqxSzXe8+GhknoW0=
github.com/hashicorp/terraform-plugin-sdk v1.7.0/go.mod h1:OjgQmey5VxnPej/buEhe+YqKm0KNvV3QqU4hkqHqPCY=
github.com/hashicorp/terraform-plugin-sdk v1.12.0 h1:HPp65ShSsKUMPf6jD50UQn/xAjyrGVO4FxI63bvu+pc=
github.com/hashicorp/terraform-plugin-test v1.2.0/go.mod h1:QIJHYz8j+xJtdtLrFTlzQVC0ocr3rf/OjIpgZLK56Hs=
github.com/hashicorp/terraform-svchost v0.0.0-20191011084731-65d371908596 h1:hjyO2JsNZUKT1ym+FAdlBEkGPevazYsmVgIMw7dVELg=
github.com/hashicorp/terraform-svchost v0.0.0-20191011084731-65d371908596/go.mod h1:kNDNcF7sN4DocDLBkQYz73HGKwN1ANB1blq4lIYLYvg=
Expand Down
40 changes: 34 additions & 6 deletions provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,41 @@ import (

func Provider() *schema.Provider {
return &schema.Provider{
Schema: map[string]*schema.Schema{
"api_url": {
Type: schema.TypeString,
// Required: true,
Optional: true,
Default: "https://g.codefresh.io/api",
},
"token": {
Type: schema.TypeString,
Required: true,
// Optional: true,
DefaultFunc: schema.EnvDefaultFunc("CODEFRESH_API_KEY", ""),
},
},
ResourcesMap: map[string]*schema.Resource{
"codefresh_project": resourceProject(),
"codefresh_pipeline": resourcePipeline(),
"codefresh_cron_event": resourceCronEvent(),
"codefresh_cron_trigger": resourceCronTrigger(),
"codefresh_user": resourceUser(),
"codefresh_environment": resourceEnvironment(),
"codefresh_project": resourceProject(),
"codefresh_pipeline": resourcePipeline(),
// "codefresh_cron_event": resourceCronEvent(),
// "codefresh_cron_trigger": resourceCronTrigger(),
// "codefresh_user": resourceUser(),
// "codefresh_environment": resourceEnvironment(),
},
ConfigureFunc: configureProvider,
}
}

func configureProvider(d *schema.ResourceData) (interface{}, error) {
config := Config{
APIServer: d.Get("api_url").(string),
Token: d.Get("token").(string),
}

// if err := config.LoadAndValidate(); err != nil {
// return nil, err
// }

return &config, nil
}
203 changes: 0 additions & 203 deletions resource_cron_event.go

This file was deleted.

125 changes: 0 additions & 125 deletions resource_cron_trigger.go

This file was deleted.

Loading

0 comments on commit 17d4c61

Please sign in to comment.