From ec1faf1938500435aa824926e7d85b9360b257bf Mon Sep 17 00:00:00 2001 From: KeisukeYamashita <19yamashita15@gmail.com> Date: Fri, 14 Aug 2020 12:49:43 +0900 Subject: [PATCH] fix(application): name validation with clouddriver --- CHANGELOG.md | 8 ++++++-- spinnaker/api/application.go | 2 +- spinnaker/resource_application.go | 1 + 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 20a6dd9..a714740 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ -## v0.2.3 (Unreleased) +## v0.2.4 (Unreleased) -## v0.2.2 (Auguest 12, 2020) +## v0.2.3 (August 14, 2020) +### Bug fixes +* Fixed validation errors if the user uses deprecated `application` for `spinnaker_application` resource. [#63](https://github.com/mercari/terraform-provider-spinnaker/pull/63) + +## v0.2.2 (August 12, 2020) ### Improvements * Add `spinnaker_canary_config` resource/data source for defining canary config. ([#55](https://github.com/mercari/terraform-provider-spinnaker/pull/55)) * Note that this currently supports only Cloud Monitoring. diff --git a/spinnaker/api/application.go b/spinnaker/api/application.go index ee0cec3..788d80e 100644 --- a/spinnaker/api/application.go +++ b/spinnaker/api/application.go @@ -56,7 +56,7 @@ func NewCreateApplicationTask(d *schema.ResourceData) (CreateApplicationTask, er cloudProviders := make([]string, len(input)) for k, input := range v.([]interface{}) { cloudProvider := input.(string) - if err := validateSpinnakerApplicationNameByCloudProvider(d.Get("name").(string), cloudProvider); err != nil { + if err := validateSpinnakerApplicationNameByCloudProvider(GetApplicationName(d), cloudProvider); err != nil { return nil, err } diff --git a/spinnaker/resource_application.go b/spinnaker/resource_application.go index 274c00a..23522d4 100644 --- a/spinnaker/resource_application.go +++ b/spinnaker/resource_application.go @@ -22,6 +22,7 @@ func resourceSpinnakerApplication() *schema.Resource { Deprecated: "use `name` instead", Optional: true, ConflictsWith: []string{"name"}, + ValidateFunc: validateSpinnakerApplicationName, }, "name": { Description: "Name of the Application",