Skip to content

Commit

Permalink
Handle attribute 'is_secure' better while flattening PluginConfiguration
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhilsbhat committed Dec 30, 2022
1 parent c67b936 commit 56b965b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
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_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"
}
}
//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"
// }
//}
6 changes: 4 additions & 2 deletions gocd/resource_plugin_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,14 +182,16 @@ func resourcePluginsSettingsDelete(ctx context.Context, d *schema.ResourceData,

func getPluginConfiguration(configs interface{}) []gocd.PluginConfiguration {
pluginsConfigurations := make([]gocd.PluginConfiguration, 0)
for _, config := range configs.(*schema.Set).List() {
for i, config := range configs.(*schema.Set).List() {
v := config.(map[string]interface{})
pluginsConfigurations = append(pluginsConfigurations, gocd.PluginConfiguration{
Key: utils.String(v[utils.TerraformResourceKey]),
Value: utils.String(v[utils.TerraformResourceValue]),
EncryptedValue: utils.String(v[utils.TerraformResourceENCValue]),
IsSecure: utils.Bool(v[utils.TerraformResourceIsSecure]),
})
if isSecure, ok := v[utils.TerraformResourceIsSecure]; ok {
pluginsConfigurations[i].IsSecure = utils.Bool(isSecure)
}
}

return pluginsConfigurations
Expand Down

0 comments on commit 56b965b

Please sign in to comment.