diff --git a/aws/resource_aws_elastic_beanstalk_environment.go b/aws/resource_aws_elastic_beanstalk_environment.go index fa1e2562bd7..eae7444081d 100644 --- a/aws/resource_aws_elastic_beanstalk_environment.go +++ b/aws/resource_aws_elastic_beanstalk_environment.go @@ -769,6 +769,7 @@ func optionSettingValueHash(v interface{}) int { resourceName = v } value, _ := rd["value"].(string) + value, _ = normalizeJsonString(value) hk := fmt.Sprintf("%s:%s%s=%s", namespace, optionName, resourceName, sortValues(value)) log.Printf("[DEBUG] Elastic Beanstalk optionSettingValueHash(%#v): %s: hk=%s,hc=%d", v, optionName, hk, hashcode.String(hk)) return hashcode.String(hk) diff --git a/aws/resource_aws_elastic_beanstalk_environment_test.go b/aws/resource_aws_elastic_beanstalk_environment_test.go index 27633af5088..7d1ee1b98d2 100644 --- a/aws/resource_aws_elastic_beanstalk_environment_test.go +++ b/aws/resource_aws_elastic_beanstalk_environment_test.go @@ -287,6 +287,24 @@ func TestAccAWSBeanstalkEnv_version_label(t *testing.T) { }) } +func TestAccAWSBeanstalkEnv_settingWithJsonValue(t *testing.T) { + var app elasticbeanstalk.EnvironmentDescription + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckBeanstalkEnvDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccBeanstalkEnvSettingJsonValue(acctest.RandInt()), + Check: resource.ComposeTestCheckFunc( + testAccCheckBeanstalkEnvExists("aws_elastic_beanstalk_environment.default", &app), + ), + }, + }, + }) +} + func testAccVerifyBeanstalkConfig(env *elasticbeanstalk.EnvironmentDescription, expected []string) resource.TestCheckFunc { return func(s *terraform.State) error { if env == nil { @@ -992,3 +1010,214 @@ resource "aws_elastic_beanstalk_environment" "default" { } `, randInt, randInt, randInt) } + +func testAccBeanstalkEnvSettingJsonValue(randInt int) string { + return fmt.Sprintf(` +resource "aws_elastic_beanstalk_application" "app" { + name = "tf-acc-test-%d" + description = "This is a description" +} + +resource "aws_sqs_queue" "test" { + name = "tf-acc-test-%d" +} + +resource "aws_key_pair" "test" { + key_name = "tf-acc-test-%d" + public_key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD3F6tyPEFEzV0LX3X8BsXdMsQz1x2cEikKDEY0aIj41qgxMCP/iteneqXSIFZBp5vizPvaoIR3Um9xK7PGoW8giupGn+EPuxIA4cDM4vzOqOkiMPhz5XK0whEjkVzTo4+S0puvDZuwIsdiW9mxhJc7tgBNL0cYlWSYVkz4G/fslNfRPW5mYAM49f4fhtxPb5ok4Q2Lg9dPKVHO/Bgeu5woMc7RY0p1ej6D4CKFE6lymSDJpW0YHX/wqE9+cfEauh7xZcG0q9t2ta6F6fmX0agvpFyZo8aFbXeUBr7osSCJNgvavWbM/06niWrOvYX2xwWdhXmXSrbX8ZbabVohBK41 email@example.com" +} + +resource "aws_iam_instance_profile" "app" { + name = "tf-acc-test-%d" + role = "${aws_iam_role.test.name}" +} + +resource "aws_iam_role" "test" { + name = "tf_acc_test_%d" + path = "/" + + assume_role_policy = <