<commit_before>package aws

import (
	"fmt"
	"reflect"
	"testing"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/awserr"
	"github.com/aws/aws-sdk-go/service/opsworks"
	"github.com/hashicorp/terraform/helper/resource"
	"github.com/hashicorp/terraform/terraform"
)

func TestAccAWSOpsworksApplication(t *testing.T) {
	var opsapp opsworks.App
	resource.Test(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testAccCheckAwsOpsworksApplicationDestroy,
		Steps: []resource.TestStep{
			resource.TestStep{
				Config: testAccAwsOpsworksApplicationCreate,
				Check: resource.ComposeTestCheckFunc(
					testAccCheckAWSOpsworksApplicationExists(
						"aws_opsworks_application.tf-acc-app", &opsapp),
					testAccCheckAWSOpsworksCreateAppAttributes(&opsapp),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "name", "tf-ops-acc-application",
					),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "type", "other",
					),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "enable_ssl", "false",
					),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "ssl_configuration", "",
					),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "domains", "",
					),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "app_source", "",
					),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "environment.3077298702.key", "key1",
					),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "environment.3077298702.value", "value1",
					),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "environment.3077298702.secret", "",
					),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "document_root", "foo",
					),
				),
			},
			resource.TestStep{
				Config: testAccAwsOpsworksApplicationUpdate,
				Check: resource.ComposeTestCheckFunc(
					testAccCheckAWSOpsworksApplicationExists(
						"aws_opsworks_application.tf-acc-app", &opsapp),
					testAccCheckAWSOpsworksUpdateAppAttributes(&opsapp),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "name", "tf-ops-acc-application",
					),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "type", "rails",
					),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "enable_ssl", "true",
					),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "ssl_configuration.0.certificate", "-----<KEY>",
					),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "ssl_configuration.0.private_key", "-----<KEY>",
					),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "domains.0", "example.com",
					),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "domains.1", "sub.example.com",
					),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "app_source.0.password", "",
					),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "app_source.0.revision", "master",
					),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "app_source.0.ssh_key", "",
					),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "app_source.0.type", "git",
					),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "app_source.0.url", "https://github.com/aws/example.git",
					),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "app_source.0.username", "",
					),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "environment.2107898637.key", "key2",
					),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "environment.2107898637.value", "value2",
					),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "environment.2107898637.secure", "true",
					),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "environment.3077298702.key", "key1",
					),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "environment.3077298702.value", "value1",
					),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "environment.3077298702.secret", "",
					),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "document_root", "root",
					),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "auto_bundle_on_deploy", "true",<commit_msg>aws: Fix opsworks app acc test w/ missing value<commit_after>package aws

import (
	"fmt"
	"reflect"
	"testing"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/awserr"
	"github.com/aws/aws-sdk-go/service/opsworks"
	"github.com/hashicorp/terraform/helper/resource"
	"github.com/hashicorp/terraform/terraform"
)

func TestAccAWSOpsworksApplication(t *testing.T) {
	var opsapp opsworks.App
	resource.Test(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testAccCheckAwsOpsworksApplicationDestroy,
		Steps: []resource.TestStep{
			resource.TestStep{
				Config: testAccAwsOpsworksApplicationCreate,
				Check: resource.ComposeTestCheckFunc(
					testAccCheckAWSOpsworksApplicationExists(
						"aws_opsworks_application.tf-acc-app", &opsapp),
					testAccCheckAWSOpsworksCreateAppAttributes(&opsapp),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "name", "tf-ops-acc-application",
					),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "type", "other",
					),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "enable_ssl", "false",
					),
					resource.TestCheckNoResourceAttr(
						"aws_opsworks_application.tf-acc-app", "ssl_configuration",
					),
					resource.TestCheckNoResourceAttr(
						"aws_opsworks_application.tf-acc-app", "domains",
					),
					resource.TestCheckNoResourceAttr(
						"aws_opsworks_application.tf-acc-app", "app_source",
					),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "environment.3077298702.key", "key1",
					),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "environment.3077298702.value", "value1",
					),
					resource.TestCheckNoResourceAttr(
						"aws_opsworks_application.tf-acc-app", "environment.3077298702.secret",
					),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "document_root", "foo",
					),
				),
			},
			resource.TestStep{
				Config: testAccAwsOpsworksApplicationUpdate,
				Check: resource.ComposeTestCheckFunc(
					testAccCheckAWSOpsworksApplicationExists(
						"aws_opsworks_application.tf-acc-app", &opsapp),
					testAccCheckAWSOpsworksUpdateAppAttributes(&opsapp),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "name", "tf-ops-acc-application",
					),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "type", "rails",
					),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "enable_ssl", "true",
					),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "ssl_configuration.0.certificate", "-----<KEY>",
					),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "ssl_configuration.0.private_key", "-----<KEY>",
					),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "domains.0", "example.com",
					),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "domains.1", "sub.example.com",
					),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "app_source.0.password", "",
					),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "app_source.0.revision", "master",
					),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "app_source.0.ssh_key", "",
					),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "app_source.0.type", "git",
					),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "app_source.0.url", "https://github.com/aws/example.git",
					),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "app_source.0.username", "",
					),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "environment.2107898637.key", "key2",
					),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "environment.2107898637.value", "value2",
					),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "environment.2107898637.secure", "true",
					),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "environment.3077298702.key", "key1",
					),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "environment.3077298702.value", "value1",
					),
					resource.TestCheckNoResourceAttr(
						"aws_opsworks_application.tf-acc-app", "environment.3077298702.secret",
					),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "document_root", "root",
					),
					resource.TestCheckResourceAttr(
						"aws_opsworks_application.tf-acc-app", "auto_bundle_on_deploy", "true",
{'fraction_non_alphanumeric': 0.1372290864897711, 'fraction_numerical': 0.02147052866113024, 'mean_word_length': 3.8525798525798525, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3213007', 'n_tokens_mistral': 4224, 'n_tokens_neox': 3281, 'n_words': 331}