Skip to content

Commit

Permalink
r/aws_amplify_app: Remove 'custom_headers' - Not amenable to IaC.
Browse files Browse the repository at this point in the history
  • Loading branch information
ewbankkit committed May 20, 2021
1 parent 76e401e commit f88c0fd
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 72 deletions.
15 changes: 0 additions & 15 deletions aws/resource_aws_amplify_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,6 @@ func resourceAwsAmplifyApp() *schema.Resource {
ValidateFunc: validation.StringLenBetween(1, 25000),
},

"custom_headers": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringLenBetween(1, 25000),
},

"custom_rule": {
Type: schema.TypeList,
Optional: true,
Expand Down Expand Up @@ -356,10 +350,6 @@ func resourceAwsAmplifyAppCreate(d *schema.ResourceData, meta interface{}) error
input.BuildSpec = aws.String(v.(string))
}

if v, ok := d.GetOk("custom_headers"); ok {
input.CustomHeaders = aws.String(v.(string))
}

if v, ok := d.GetOk("custom_rule"); ok && len(v.([]interface{})) > 0 {
input.CustomRules = expandAmplifyCustomRules(v.([]interface{}))
}
Expand Down Expand Up @@ -448,7 +438,6 @@ func resourceAwsAmplifyAppRead(d *schema.ResourceData, meta interface{}) error {
d.Set("auto_branch_creation_patterns", aws.StringValueSlice(app.AutoBranchCreationPatterns))
d.Set("basic_auth_credentials", app.BasicAuthCredentials)
d.Set("build_spec", app.BuildSpec)
d.Set("custom_headers", app.CustomHeaders)
if err := d.Set("custom_rule", flattenAmplifyCustomRules(app.CustomRules)); err != nil {
return fmt.Errorf("error setting custom_rule: %w", err)
}
Expand Down Expand Up @@ -518,10 +507,6 @@ func resourceAwsAmplifyAppUpdate(d *schema.ResourceData, meta interface{}) error
input.BuildSpec = aws.String(d.Get("build_spec").(string))
}

if d.HasChange("custom_headers") {
input.CustomHeaders = aws.String(d.Get("custom_headers").(string))
}

if d.HasChange("custom_rule") {
if v := d.Get("custom_rule").([]interface{}); len(v) > 0 {
input.CustomRules = expandAmplifyCustomRules(v)
Expand Down
57 changes: 0 additions & 57 deletions aws/resource_aws_amplify_app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ func TestAccAWSAmplifyApp_basic(t *testing.T) {
resource.TestCheckResourceAttr(resourceName, "auto_branch_creation_patterns.#", "0"),
resource.TestCheckResourceAttr(resourceName, "basic_auth_credentials", ""),
resource.TestCheckResourceAttr(resourceName, "build_spec", ""),
resource.TestCheckResourceAttr(resourceName, "custom_headers", ""),
resource.TestCheckResourceAttr(resourceName, "custom_rule.#", "0"),
resource.TestMatchResourceAttr(resourceName, "default_domain", regexp.MustCompile(`\.amplifyapp\.com$`)),
resource.TestCheckResourceAttr(resourceName, "description", ""),
Expand Down Expand Up @@ -370,52 +369,6 @@ func TestAccAWSAmplifyApp_BuildSpec(t *testing.T) {
})
}

/*
func TestAccAWSAmplifyApp_CustomHeaders(t *testing.T) {
var app amplify.App
rName := acctest.RandomWithPrefix("tf-acc-test")
resourceName := "aws_amplify_app.test"
customHeaders1 := `{"customHeaders":[{"pattern":"*.json","headers":[{"key":"custom-header-name-1","value":"custom-header-value-1"}]}]}`
customHeaders2 := `{"customHeaders":[{"pattern":"*.json","headers":[{"key":"custom-header-name-2","value":"custom-header-value-2"}]},{"pattern":"/path/*","headers":[{"key":"custom-header-name-1","value":"custom-header-value-1"}]}]}`
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSAmplify(t) },
ErrorCheck: testAccErrorCheck(t, amplify.EndpointsID),
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSAmplifyAppDestroy,
Steps: []resource.TestStep{
{
Config: testAccAWSAmplifyAppConfigCustomHeaders(rName, customHeaders1),
Check: resource.ComposeTestCheckFunc(
testAccCheckAWSAmplifyAppExists(resourceName, &app),
resource.TestCheckResourceAttr(resourceName, "custom_headers", customHeaders1),
),
},
{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
},
{
Config: testAccAWSAmplifyAppConfigCustomHeaders(rName, ""),
Check: resource.ComposeTestCheckFunc(
testAccCheckAWSAmplifyAppExists(resourceName, &app),
resource.TestCheckResourceAttr(resourceName, "custom_headers", customHeaders2),
),
},
{
Config: testAccAWSAmplifyAppConfigName(rName),
Check: resource.ComposeTestCheckFunc(
testAccCheckAWSAmplifyAppExists(resourceName, &app),
resource.TestCheckResourceAttr(resourceName, "custom_headers", ""),
),
},
},
})
}
*/

func TestAccAWSAmplifyApp_CustomRules(t *testing.T) {
var app amplify.App
rName := acctest.RandomWithPrefix("tf-acc-test")
Expand Down Expand Up @@ -777,16 +730,6 @@ resource "aws_amplify_app" "test" {
`, rName, buildSpec)
}

func testAccAWSAmplifyAppConfigCustomHeaders(rName, customHeaders string) string {
return fmt.Sprintf(`
resource "aws_amplify_app" "test" {
name = %[1]q
custom_headers = %[2]q
}
`, rName, customHeaders)
}

func testAccAWSAmplifyAppConfigCustomRules(rName string) string {
return fmt.Sprintf(`
resource "aws_amplify_app" "test" {
Expand Down

0 comments on commit f88c0fd

Please sign in to comment.