Skip to content

Commit

Permalink
fix: set RetrievalRoleArn only when the value isn't empty
Browse files Browse the repository at this point in the history
To avoid the following error.

```
Error: Error creating AppConfig ConfigurationProfile: InvalidParameter: 1 validation error(s) found.
- minimum field size of 20, CreateConfigurationProfileInput.RetrievalRoleArn.
```
  • Loading branch information
suzuki-shunsuke committed Jul 12, 2021
1 parent 68586b5 commit ef6252e
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions aws/resource_aws_appconfig_configuration_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,16 @@ func resourceAwsAppconfigConfigurationProfileCreate(d *schema.ResourceData, meta
conn := meta.(*AWSClient).appconfigconn

input := &appconfig.CreateConfigurationProfileInput{
Name: aws.String(d.Get("name").(string)),
Description: aws.String(d.Get("description").(string)),
LocationUri: aws.String(d.Get("location_uri").(string)),
RetrievalRoleArn: aws.String(d.Get("retrieval_role_arn").(string)),
ApplicationId: aws.String(d.Get("application_id").(string)),
Validators: expandAppconfigValidators(d.Get("validators").([]interface{})),
Tags: keyvaluetags.New(d.Get("tags").(map[string]interface{})).IgnoreAws().AppconfigTags(),
Name: aws.String(d.Get("name").(string)),
Description: aws.String(d.Get("description").(string)),
LocationUri: aws.String(d.Get("location_uri").(string)),
ApplicationId: aws.String(d.Get("application_id").(string)),
Validators: expandAppconfigValidators(d.Get("validators").([]interface{})),
Tags: keyvaluetags.New(d.Get("tags").(map[string]interface{})).IgnoreAws().AppconfigTags(),
}

if retrievalRoleARN := d.Get("retrieval_role_arn").(string); retrievalRoleARN != "" {
input.RetrievalRoleArn = aws.String(retrievalRoleARN)
}

profile, err := conn.CreateConfigurationProfile(input)
Expand Down

0 comments on commit ef6252e

Please sign in to comment.