Skip to content

Commit

Permalink
Rename resource plugin settings
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhilsbhat committed Dec 30, 2022
1 parent 861a98e commit c67b936
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion examples/json_plugins_setttings.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//resource "gocd_plugins" "json_plugin_settings" {
//resource "gocd_plugin_setting" "json_plugin_settings" {
// plugin_id = "json.config.plugin"
// plugin_configurations {
// key = "pipeline_pattern"
Expand Down
22 changes: 11 additions & 11 deletions examples/yaml_plugins_setttings.tf
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
//resource "gocd_plugins" "yaml_plugin_settings" {
// plugin_id = "yaml.config.plugin"
// plugin_configurations {
// key = "file_pattern"
// value = "*.gocd.yaml"
// }
// plugin_configurations {
// key = "file_pattern"
// value = "*.gocd.yam"
// }
//}
resource "gocd_plugin_setting" "yaml_plugin_settings" {
plugin_id = "yaml.config.plugin"
plugin_configurations {
key = "file_pattern"
value = "*.gocd.yaml"
}
plugin_configurations {
key = "file_pattern"
value = "*.gocd.yam"
}
}
2 changes: 1 addition & 1 deletion gocd/cluster_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func resourceClusterProfileUpdate(ctx context.Context, d *schema.ResourceData, m
return diag.Errorf("updating cluster profile %s errored with: %v", cfg.ID, err)
}

return resourcePluginsRead(ctx, d, meta)
return resourceClusterProfileRead(ctx, d, meta)
}
}

Expand Down
2 changes: 1 addition & 1 deletion gocd/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func Provider() *schema.Provider {
},

ResourcesMap: map[string]*schema.Resource{
"gocd_plugins": resourcePlugins(),
"gocd_plugin_setting": resourcePluginsSetting(),
"gocd_auth_config": resourceAuthConfig(),
"gocd_cluster_profile": clusterProfile(),
"gocd_elastic_agent_profile": elasticAgentProfile(),
Expand Down
22 changes: 11 additions & 11 deletions gocd/resource_plugins.go → gocd/resource_plugin_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

func resourcePlugins() *schema.Resource {
func resourcePluginsSetting() *schema.Resource {
return &schema.Resource{
CreateContext: resourcePluginsCreate,
ReadContext: resourcePluginsRead,
DeleteContext: resourcePluginsDelete,
UpdateContext: resourcePluginsUpdate,
CreateContext: resourcePluginsSettingsCreate,
ReadContext: resourcePluginsSettingsRead,
DeleteContext: resourcePluginsSettingsDelete,
UpdateContext: resourcePluginsSettingsUpdate,
Schema: map[string]*schema.Schema{
"plugin_id": {
Type: schema.TypeString,
Expand Down Expand Up @@ -82,7 +82,7 @@ func resourcePlugins() *schema.Resource {
}
}

func resourcePluginsCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
func resourcePluginsSettingsCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
defaultConfig := meta.(gocd.GoCd)

if !d.IsNewResource() {
Expand Down Expand Up @@ -113,10 +113,10 @@ func resourcePluginsCreate(ctx context.Context, d *schema.ResourceData, meta int

d.SetId(id)

return resourcePluginsRead(ctx, d, meta)
return resourcePluginsSettingsRead(ctx, d, meta)
}

func resourcePluginsRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
func resourcePluginsSettingsRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
defaultConfig := meta.(gocd.GoCd)

response, err := defaultConfig.GetPluginSettings(utils.String(d.Get(utils.TerraformPluginID)))
Expand All @@ -131,7 +131,7 @@ func resourcePluginsRead(ctx context.Context, d *schema.ResourceData, meta inter
return nil
}

func resourcePluginsUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
func resourcePluginsSettingsUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
defaultConfig := meta.(gocd.GoCd)

if d.HasChange(utils.TerraformResourcePluginConfiguration) {
Expand All @@ -148,7 +148,7 @@ func resourcePluginsUpdate(ctx context.Context, d *schema.ResourceData, meta int
return diag.Errorf("updating plugin configuration errored with: %v", err)
}

return resourcePluginsRead(ctx, d, meta)
return resourcePluginsSettingsRead(ctx, d, meta)
}
}

Expand All @@ -157,7 +157,7 @@ func resourcePluginsUpdate(ctx context.Context, d *schema.ResourceData, meta int
return nil
}

func resourcePluginsDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
func resourcePluginsSettingsDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
defaultConfig := meta.(gocd.GoCd)

if id := d.Id(); len(id) == 0 {
Expand Down

0 comments on commit c67b936

Please sign in to comment.