From 7e7765f48410cf40728b32e5b876005a45612819 Mon Sep 17 00:00:00 2001 From: Angie Pinilla Date: Wed, 1 Dec 2021 19:43:04 -0500 Subject: [PATCH] CR updates to align with AWS API --- .changelog/11487.txt | 7 + internal/provider/provider.go | 10 +- internal/service/codecommit/approval_rule.go | 170 ------------ .../codecommit/approval_rule_data_source.go | 71 ----- .../codecommit/approval_rule_template.go | 205 +++++++++++++++ .../approval_rule_template_data_source.go | 87 +++++++ ...pproval_rule_template_data_source_test.go} | 29 ++- .../codecommit/approval_rule_template_test.go | 246 ++++++++++++++++++ .../service/codecommit/approval_rule_test.go | 188 ------------- .../d/codecommit_approval_rule.html.markdown | 33 --- ...ommit_approval_rule_template.html.markdown | 37 +++ .../r/codecommit_approval_rule.html.markdown | 57 ---- ...ommit_approval_rule_template.html.markdown | 58 +++++ 13 files changed, 665 insertions(+), 533 deletions(-) create mode 100644 .changelog/11487.txt delete mode 100644 internal/service/codecommit/approval_rule.go delete mode 100644 internal/service/codecommit/approval_rule_data_source.go create mode 100644 internal/service/codecommit/approval_rule_template.go create mode 100644 internal/service/codecommit/approval_rule_template_data_source.go rename internal/service/codecommit/{approval_rule_data_source_test.go => approval_rule_template_data_source_test.go} (51%) create mode 100644 internal/service/codecommit/approval_rule_template_test.go delete mode 100644 internal/service/codecommit/approval_rule_test.go delete mode 100644 website/docs/d/codecommit_approval_rule.html.markdown create mode 100644 website/docs/d/codecommit_approval_rule_template.html.markdown delete mode 100644 website/docs/r/codecommit_approval_rule.html.markdown create mode 100644 website/docs/r/codecommit_approval_rule_template.html.markdown diff --git a/.changelog/11487.txt b/.changelog/11487.txt new file mode 100644 index 00000000000..447c4cfa996 --- /dev/null +++ b/.changelog/11487.txt @@ -0,0 +1,7 @@ +```release-note:new-resource +aws_codecommit_approval_rule_template +``` + +```release-note:new-data-source +aws_codecommit_approval_rule_template +``` \ No newline at end of file diff --git a/internal/provider/provider.go b/internal/provider/provider.go index 712ed58f74f..30bd3d76078 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -392,8 +392,8 @@ func Provider() *schema.Provider { "aws_codeartifact_authorization_token": codeartifact.DataSourceAuthorizationToken(), "aws_codeartifact_repository_endpoint": codeartifact.DataSourceRepositoryEndpoint(), - "aws_codecommit_approval_rule": codecommit.DataSourceApprovalRule(), - "aws_codecommit_repository": codecommit.DataSourceRepository(), + "aws_codecommit_approval_rule_template": codecommit.DataSourceApprovalRuleTemplate(), + "aws_codecommit_repository": codecommit.DataSourceRepository(), "aws_codestarconnections_connection": codestarconnections.DataSourceConnection(), @@ -912,9 +912,9 @@ func Provider() *schema.Provider { "aws_codebuild_source_credential": codebuild.ResourceSourceCredential(), "aws_codebuild_webhook": codebuild.ResourceWebhook(), - "aws_codecommit_approval_rule": codecommit.ResourceApprovalRule(), - "aws_codecommit_repository": codecommit.ResourceRepository(), - "aws_codecommit_trigger": codecommit.ResourceTrigger(), + "aws_codecommit_approval_rule_template": codecommit.ResourceApprovalRuleTemplate(), + "aws_codecommit_repository": codecommit.ResourceRepository(), + "aws_codecommit_trigger": codecommit.ResourceTrigger(), "aws_codedeploy_app": codedeploy.ResourceApp(), "aws_codedeploy_deployment_config": codedeploy.ResourceDeploymentConfig(), diff --git a/internal/service/codecommit/approval_rule.go b/internal/service/codecommit/approval_rule.go deleted file mode 100644 index 1ba139c37e0..00000000000 --- a/internal/service/codecommit/approval_rule.go +++ /dev/null @@ -1,170 +0,0 @@ -package codecommit - -import ( - "fmt" - "log" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/codecommit" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/structure" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - "github.com/hashicorp/terraform-provider-aws/internal/conns" -) - -func ResourceApprovalRule() *schema.Resource { - return &schema.Resource{ - Create: resourceApprovalRuleCreate, - Read: resourceApprovalRuleRead, - Update: resourceApprovalRuleUpdate, - Delete: resourceApprovalRuleDelete, - Importer: &schema.ResourceImporter{ - State: schema.ImportStatePassthrough, - }, - - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - ForceNew: true, - Required: true, - }, - "content": { - Type: schema.TypeString, - Required: true, - ValidateFunc: validateApprovalRuleContentValue(), - StateFunc: func(v interface{}) string { - json, _ := structure.NormalizeJsonString(v.(string)) - return json - }, - }, - "description": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: validation.StringLenBetween(0, 512), - }, - "approval_rule_template_id": { - Type: schema.TypeString, - Computed: true, - }, - }, - } -} - -func resourceApprovalRuleCreate(d *schema.ResourceData, meta interface{}) error { - conn := meta.(*conns.AWSClient).CodeCommitConn - - input := &codecommit.CreateApprovalRuleTemplateInput{ - ApprovalRuleTemplateName: aws.String(d.Get("name").(string)), - ApprovalRuleTemplateDescription: aws.String(d.Get("description").(string)), - ApprovalRuleTemplateContent: aws.String(d.Get("content").(string)), - } - - resp, err := conn.CreateApprovalRuleTemplate(input) - if err != nil { - return fmt.Errorf("Error creating CodeCommit Approval Rule Template: %s", err) - } - - log.Printf("[INFO] Code Commit Approval Rule template Created %s input %s", resp, input) - - d.SetId(d.Get("name").(string)) - - return resourceApprovalRuleRead(d, meta) -} - -func resourceApprovalRuleRead(d *schema.ResourceData, meta interface{}) error { - conn := meta.(*conns.AWSClient).CodeCommitConn - - input := &codecommit.GetApprovalRuleTemplateInput{ - ApprovalRuleTemplateName: aws.String(d.Id()), - } - - resp, err := conn.GetApprovalRuleTemplate(input) - if err != nil { - return fmt.Errorf("Error reading CodeCommit Approval Rule Template: %s", err.Error()) - } - - log.Printf("[DEBUG] CodeCommit Approval Rule Template: %s", resp) - - d.Set("name", resp.ApprovalRuleTemplate.ApprovalRuleTemplateName) - d.Set("approval_rule_template_id", resp.ApprovalRuleTemplate.ApprovalRuleTemplateId) - d.Set("description", resp.ApprovalRuleTemplate.ApprovalRuleTemplateDescription) - templateContent, _ := structure.NormalizeJsonString(*resp.ApprovalRuleTemplate.ApprovalRuleTemplateContent) - d.Set("content", templateContent) - - return nil -} - -func resourceApprovalRuleUpdate(d *schema.ResourceData, meta interface{}) error { - conn := meta.(*conns.AWSClient).CodeCommitConn - - if d.HasChange("description") { - log.Printf("[DEBUG] Updating Code Commit approval rule template %q description", d.Id()) - _, n := d.GetChange("description") - input := &codecommit.UpdateApprovalRuleTemplateDescriptionInput{ - ApprovalRuleTemplateDescription: aws.String(n.(string)), - ApprovalRuleTemplateName: aws.String(d.Get("name").(string)), - } - - _, err := conn.UpdateApprovalRuleTemplateDescription(input) - - if err != nil { - return err - } - log.Printf("[DEBUG] Code Commit approval rule template (%q) description updated", d.Id()) - } - - if d.HasChange("content") { - log.Printf("[DEBUG] Updating Code Commit approval rule template %q content", d.Id()) - _, n := d.GetChange("content") - newContent, _ := structure.NormalizeJsonString(n) - - input := &codecommit.UpdateApprovalRuleTemplateContentInput{ - NewRuleContent: aws.String(newContent), - ApprovalRuleTemplateName: aws.String(d.Get("name").(string)), - } - - _, err := conn.UpdateApprovalRuleTemplateContent(input) - - if err != nil { - return err - } - log.Printf("[DEBUG] Code Commit approval rule template (%q) content updated", d.Id()) - } - - return resourceApprovalRuleRead(d, meta) -} - -func resourceApprovalRuleDelete(d *schema.ResourceData, meta interface{}) error { - conn := meta.(*conns.AWSClient).CodeCommitConn - - log.Printf("[DEBUG] Deleting Approval Rule Template: %q", d.Id()) - - input := &codecommit.DeleteApprovalRuleTemplateInput{ - ApprovalRuleTemplateName: aws.String(d.Get("name").(string)), - } - - _, err := conn.DeleteApprovalRuleTemplate(input) - - return err -} - -func validateApprovalRuleContentValue() schema.SchemaValidateFunc { - return func(v interface{}, k string) (ws []string, errors []error) { - json, err := structure.NormalizeJsonString(v) - if err != nil { - errors = append(errors, fmt.Errorf("%q contains an invalid JSON: %s", k, err)) - - // Invalid JSON? Return immediately, - // there is no need to collect other - // errors. - return - } - - // Check whether the normalized JSON is within the given length. - if len(json) > 3000 { - errors = append(errors, fmt.Errorf( - "%q cannot be longer than %d characters: %q", k, 3000, json)) - } - return - } -} diff --git a/internal/service/codecommit/approval_rule_data_source.go b/internal/service/codecommit/approval_rule_data_source.go deleted file mode 100644 index f79f5456c8a..00000000000 --- a/internal/service/codecommit/approval_rule_data_source.go +++ /dev/null @@ -1,71 +0,0 @@ -package codecommit - -import ( - "fmt" - "log" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/codecommit" - "github.com/hashicorp/aws-sdk-go-base/tfawserr" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/structure" - "github.com/hashicorp/terraform-provider-aws/internal/conns" -) - -func DataSourceApprovalRule() *schema.Resource { - return &schema.Resource{ - Read: dataSourceApprovalRuleRead, - - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - }, - "content": { - Type: schema.TypeString, - Computed: true, - }, - "description": { - Type: schema.TypeString, - Computed: true, - }, - "approval_rule_template_id": { - Type: schema.TypeString, - Computed: true, - }, - }, - } -} - -func dataSourceApprovalRuleRead(d *schema.ResourceData, meta interface{}) error { - conn := meta.(*conns.AWSClient).CodeCommitConn - - templateName := d.Get("name").(string) - input := &codecommit.GetApprovalRuleTemplateInput{ - ApprovalRuleTemplateName: aws.String(templateName), - } - - out, err := conn.GetApprovalRuleTemplate(input) - if err != nil { - if tfawserr.ErrCodeEquals(err, codecommit.ErrCodeApprovalRuleTemplateDoesNotExistException) { - log.Printf("[WARN] CodeCommit Approval Rule (%s) not found, removing from state", d.Id()) - d.SetId("") - return fmt.Errorf("Resource codecommit approval rule not found for %s", templateName) - } else { - return fmt.Errorf("Error reading CodeCommit Approval Rule: %s", err.Error()) - } - } - - if out.ApprovalRuleTemplate == nil { - return fmt.Errorf("no matches found for approval rule name: %s", templateName) - } - - d.SetId(aws.StringValue(out.ApprovalRuleTemplate.ApprovalRuleTemplateName)) - d.Set("name", out.ApprovalRuleTemplate.ApprovalRuleTemplateName) - d.Set("approval_rule_template_id", out.ApprovalRuleTemplate.ApprovalRuleTemplateId) - d.Set("description", out.ApprovalRuleTemplate.ApprovalRuleTemplateDescription) - templateContent, _ := structure.NormalizeJsonString(*out.ApprovalRuleTemplate.ApprovalRuleTemplateContent) - d.Set("content", templateContent) - - return nil -} diff --git a/internal/service/codecommit/approval_rule_template.go b/internal/service/codecommit/approval_rule_template.go new file mode 100644 index 00000000000..5b7991cb5b0 --- /dev/null +++ b/internal/service/codecommit/approval_rule_template.go @@ -0,0 +1,205 @@ +package codecommit + +import ( + "fmt" + "log" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/codecommit" + "github.com/hashicorp/aws-sdk-go-base/tfawserr" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/structure" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + "github.com/hashicorp/terraform-provider-aws/internal/conns" + "github.com/hashicorp/terraform-provider-aws/internal/verify" +) + +func ResourceApprovalRuleTemplate() *schema.Resource { + return &schema.Resource{ + Create: resourceApprovalRuleTemplateCreate, + Read: resourceApprovalRuleTemplateRead, + Update: resourceApprovalRuleTemplateUpdate, + Delete: resourceApprovalRuleTemplateDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringLenBetween(1, 100), + }, + "content": { + Type: schema.TypeString, + Required: true, + DiffSuppressFunc: verify.SuppressEquivalentJSONDiffs, + StateFunc: func(v interface{}) string { + json, _ := structure.NormalizeJsonString(v) + return json + }, + ValidateFunc: validation.All( + validation.StringIsJSON, + validation.StringLenBetween(1, 3000), + ), + }, + "description": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringLenBetween(0, 1000), + }, + "approval_rule_template_id": { + Type: schema.TypeString, + Computed: true, + }, + "creation_date": { + Type: schema.TypeString, + Computed: true, + }, + "last_modified_date": { + Type: schema.TypeString, + Computed: true, + }, + "last_modified_user": { + Type: schema.TypeString, + Computed: true, + }, + "rule_content_sha256": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func resourceApprovalRuleTemplateCreate(d *schema.ResourceData, meta interface{}) error { + conn := meta.(*conns.AWSClient).CodeCommitConn + + name := d.Get("name").(string) + + input := &codecommit.CreateApprovalRuleTemplateInput{ + ApprovalRuleTemplateName: aws.String(name), + ApprovalRuleTemplateContent: aws.String(d.Get("content").(string)), + } + + if v, ok := d.GetOk("description"); ok { + input.ApprovalRuleTemplateDescription = aws.String(v.(string)) + } + + _, err := conn.CreateApprovalRuleTemplate(input) + if err != nil { + return fmt.Errorf("error creating CodeCommit Approval Rule Template (%s): %w", name, err) + } + + d.SetId(name) + + return resourceApprovalRuleTemplateRead(d, meta) +} + +func resourceApprovalRuleTemplateRead(d *schema.ResourceData, meta interface{}) error { + conn := meta.(*conns.AWSClient).CodeCommitConn + + input := &codecommit.GetApprovalRuleTemplateInput{ + ApprovalRuleTemplateName: aws.String(d.Id()), + } + + resp, err := conn.GetApprovalRuleTemplate(input) + + if !d.IsNewResource() && tfawserr.ErrCodeEquals(err, codecommit.ErrCodeApprovalRuleTemplateDoesNotExistException) { + log.Printf("[WARN] CodeCommit Approval Rule Template (%s) not found, removing from state", d.Id()) + d.SetId("") + return nil + } + + if err != nil { + return fmt.Errorf("error reading CodeCommit Approval Rule Template (%s): %w", d.Id(), err) + } + + if resp == nil || resp.ApprovalRuleTemplate == nil { + return fmt.Errorf("error reading CodeCommit Approval Rule Template (%s): empty output", d.Id()) + } + + result := resp.ApprovalRuleTemplate + + d.Set("name", result.ApprovalRuleTemplateName) + d.Set("approval_rule_template_id", result.ApprovalRuleTemplateId) + d.Set("description", result.ApprovalRuleTemplateDescription) + d.Set("content", result.ApprovalRuleTemplateContent) + d.Set("creation_date", result.CreationDate.Format(time.RFC3339)) + d.Set("last_modified_date", result.LastModifiedDate.Format(time.RFC3339)) + d.Set("last_modified_user", result.LastModifiedUser) + d.Set("rule_content_sha256", result.RuleContentSha256) + + return nil +} + +func resourceApprovalRuleTemplateUpdate(d *schema.ResourceData, meta interface{}) error { + conn := meta.(*conns.AWSClient).CodeCommitConn + + if d.HasChange("description") { + input := &codecommit.UpdateApprovalRuleTemplateDescriptionInput{ + ApprovalRuleTemplateDescription: aws.String(d.Get("description").(string)), + ApprovalRuleTemplateName: aws.String(d.Id()), + } + + _, err := conn.UpdateApprovalRuleTemplateDescription(input) + + if err != nil { + return fmt.Errorf("error updating CodeCommit Approval Rule Template (%s) description: %w", d.Id(), err) + } + } + + if d.HasChange("content") { + input := &codecommit.UpdateApprovalRuleTemplateContentInput{ + ApprovalRuleTemplateName: aws.String(d.Id()), + ExistingRuleContentSha256: aws.String(d.Get("rule_content_sha256").(string)), + NewRuleContent: aws.String(d.Get("content").(string)), + } + + _, err := conn.UpdateApprovalRuleTemplateContent(input) + + if err != nil { + return fmt.Errorf("error updating CodeCommit Approval Rule Template (%s) content: %w", d.Id(), err) + } + } + + if d.HasChange("name") { + newName := d.Get("name").(string) + + input := &codecommit.UpdateApprovalRuleTemplateNameInput{ + NewApprovalRuleTemplateName: aws.String(newName), + OldApprovalRuleTemplateName: aws.String(d.Id()), + } + + _, err := conn.UpdateApprovalRuleTemplateName(input) + + if err != nil { + return fmt.Errorf("error updating CodeCommit Approval Rule Template (%s) name: %w", d.Id(), err) + } + + d.SetId(newName) + } + + return resourceApprovalRuleTemplateRead(d, meta) +} + +func resourceApprovalRuleTemplateDelete(d *schema.ResourceData, meta interface{}) error { + conn := meta.(*conns.AWSClient).CodeCommitConn + + input := &codecommit.DeleteApprovalRuleTemplateInput{ + ApprovalRuleTemplateName: aws.String(d.Id()), + } + + _, err := conn.DeleteApprovalRuleTemplate(input) + + if tfawserr.ErrCodeEquals(err, codecommit.ErrCodeApprovalRuleTemplateDoesNotExistException) { + return nil + } + + if err != nil { + return fmt.Errorf("error deleting CodeCommit Approval Rule Template (%s): %w", d.Id(), err) + } + + return nil +} diff --git a/internal/service/codecommit/approval_rule_template_data_source.go b/internal/service/codecommit/approval_rule_template_data_source.go new file mode 100644 index 00000000000..b66c4eea281 --- /dev/null +++ b/internal/service/codecommit/approval_rule_template_data_source.go @@ -0,0 +1,87 @@ +package codecommit + +import ( + "fmt" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/codecommit" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + "github.com/hashicorp/terraform-provider-aws/internal/conns" +) + +func DataSourceApprovalRuleTemplate() *schema.Resource { + return &schema.Resource{ + Read: dataSourceApprovalRuleTemplateRead, + + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringLenBetween(1, 100), + }, + "approval_rule_template_id": { + Type: schema.TypeString, + Computed: true, + }, + "content": { + Type: schema.TypeString, + Computed: true, + }, + "creation_date": { + Type: schema.TypeString, + Computed: true, + }, + "description": { + Type: schema.TypeString, + Computed: true, + }, + "last_modified_date": { + Type: schema.TypeString, + Computed: true, + }, + "last_modified_user": { + Type: schema.TypeString, + Computed: true, + }, + "rule_content_sha256": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func dataSourceApprovalRuleTemplateRead(d *schema.ResourceData, meta interface{}) error { + conn := meta.(*conns.AWSClient).CodeCommitConn + + templateName := d.Get("name").(string) + input := &codecommit.GetApprovalRuleTemplateInput{ + ApprovalRuleTemplateName: aws.String(templateName), + } + + output, err := conn.GetApprovalRuleTemplate(input) + + if err != nil { + return fmt.Errorf("error reading CodeCommit Approval Rule Template (%s): %w", templateName, err) + } + + if output == nil || output.ApprovalRuleTemplate == nil { + return fmt.Errorf("error reading CodeCommit Approval Rule Template (%s): empty output", templateName) + } + + result := output.ApprovalRuleTemplate + + d.SetId(aws.StringValue(result.ApprovalRuleTemplateName)) + d.Set("name", result.ApprovalRuleTemplateName) + d.Set("approval_rule_template_id", result.ApprovalRuleTemplateId) + d.Set("content", result.ApprovalRuleTemplateContent) + d.Set("creation_date", result.CreationDate.Format(time.RFC3339)) + d.Set("description", result.ApprovalRuleTemplateDescription) + d.Set("last_modified_date", result.LastModifiedDate.Format(time.RFC3339)) + d.Set("last_modified_user", result.LastModifiedUser) + d.Set("rule_content_sha256", result.RuleContentSha256) + + return nil +} diff --git a/internal/service/codecommit/approval_rule_data_source_test.go b/internal/service/codecommit/approval_rule_template_data_source_test.go similarity index 51% rename from internal/service/codecommit/approval_rule_data_source_test.go rename to internal/service/codecommit/approval_rule_template_data_source_test.go index 18b0c89e11c..35d584a6ded 100644 --- a/internal/service/codecommit/approval_rule_data_source_test.go +++ b/internal/service/codecommit/approval_rule_template_data_source_test.go @@ -12,8 +12,8 @@ import ( func TestAccCodeCommitApprovalRuleTemplateDataSource_basic(t *testing.T) { rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) - resourceName := "aws_codecommit_approval_rule.default" - datasourceName := "data.aws_codecommit_approval_rule.default" + resourceName := "aws_codecommit_approval_rule_template.test" + datasourceName := "data.aws_codecommit_approval_rule_template.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(t) }, @@ -23,8 +23,13 @@ func TestAccCodeCommitApprovalRuleTemplateDataSource_basic(t *testing.T) { { Config: testAccCheckCodeCommitApprovalRuleTemplateDataSourceConfig(rName), Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrPair(datasourceName, "description", resourceName, "description"), resource.TestCheckResourceAttrPair(datasourceName, "name", resourceName, "name"), resource.TestCheckResourceAttrPair(datasourceName, "content", resourceName, "content"), + resource.TestCheckResourceAttrPair(datasourceName, "creation_date", resourceName, "creation_date"), + resource.TestCheckResourceAttrPair(datasourceName, "last_modified_date", resourceName, "last_modified_date"), + resource.TestCheckResourceAttrPair(datasourceName, "last_modified_user", resourceName, "last_modified_user"), + resource.TestCheckResourceAttrPair(datasourceName, "rule_content_sha256", resourceName, "rule_content_sha256"), ), }, }, @@ -33,22 +38,28 @@ func TestAccCodeCommitApprovalRuleTemplateDataSource_basic(t *testing.T) { func testAccCheckCodeCommitApprovalRuleTemplateDataSourceConfig(rName string) string { return fmt.Sprintf(` -resource "aws_codecommit_approval_rule" "default" { - name = "%s" - content = < **NOTE on CodeCommit Availability**: CodeCommit is not yet rolled out -in all regions - available regions are listed -[the AWS Docs](https://docs.aws.amazon.com/general/latest/gr/rande.html#codecommit_region). - -## Example Usage - -```hcl -resource "aws_codecommit_approval_rule" "test" { - name = "MyTestApprovalRule" - description = "This is a test approval rule template" - - content = <