From dfb0ba63bd92676acbb2da1096c99af9b4cadb1f Mon Sep 17 00:00:00 2001 From: GlennChia Date: Mon, 28 Mar 2022 14:10:47 +0000 Subject: [PATCH 01/17] fix(appint): remap to appintegrationsservice map appintegrations to appintegrationsservice --- internal/generate/listpages/main.go | 6 +++++- internal/generate/tags/main.go | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/internal/generate/listpages/main.go b/internal/generate/listpages/main.go index 4f9ce2ef875..24a55342cf2 100644 --- a/internal/generate/listpages/main.go +++ b/internal/generate/listpages/main.go @@ -293,6 +293,8 @@ func awsServiceName(s string) (string, error) { switch s { case "amp": return "prometheusservice", nil + case "appintegrations": + return "appintegrationsservice", nil case "cloudcontrol": return "cloudcontrolapi", nil case "cognitoidp": @@ -328,6 +330,8 @@ func awsServiceNameUpper(s string) (string, error) { return awsServiceNames["prometheusservice"], nil case "appautoscaling": return awsServiceNames["applicationautoscaling"], nil + case "appintegrations": + return awsServiceNames["appintegrationsservice"], nil case "cloudcontrol": return awsServiceNames["cloudcontrolapi"], nil case "cognitoidp": @@ -368,7 +372,7 @@ func init() { awsServiceNames["apigatewayv2"] = "APIGatewayV2" awsServiceNames["appconfig"] = "AppConfig" awsServiceNames["appflow"] = "AppFlow" - awsServiceNames["appintegrations"] = "AppIntegrations" + awsServiceNames["appintegrationsservice"] = "AppIntegrationsService" awsServiceNames["applicationautoscaling"] = "ApplicationAutoScaling" awsServiceNames["applicationcostprofiler"] = "ApplicationCostProfiler" awsServiceNames["applicationdiscovery"] = "ApplicationDiscovery" diff --git a/internal/generate/tags/main.go b/internal/generate/tags/main.go index 04e87be99a4..6086538152b 100644 --- a/internal/generate/tags/main.go +++ b/internal/generate/tags/main.go @@ -788,6 +788,8 @@ func awsServiceName(s string) (string, error) { switch s { case "amp": return "prometheusservice", nil + case "appintegrations": + return "appintegrationsservice", nil case "cloudcontrol": return "cloudcontrolapi", nil case "cognitoidp": @@ -823,6 +825,8 @@ func awsServiceNameUpper(s string) (string, error) { return awsServiceNames["prometheusservice"], nil case "appautoscaling": return awsServiceNames["applicationautoscaling"], nil + case "appintegrations": + return awsServiceNames["appintegrationsservice"], nil case "cloudcontrol": return awsServiceNames["cloudcontrolapi"], nil case "cognitoidp": @@ -870,7 +874,7 @@ func init() { awsServiceNames["apigatewayv2"] = "ApiGatewayV2" awsServiceNames["appconfig"] = "AppConfig" awsServiceNames["appflow"] = "AppFlow" - awsServiceNames["appintegrations"] = "AppIntegrations" + awsServiceNames["appintegrationsservice"] = "AppIntegrationsService" awsServiceNames["applicationautoscaling"] = "ApplicationAutoScaling" awsServiceNames["applicationcostprofiler"] = "ApplicationCostProfiler" awsServiceNames["applicationdiscovery"] = "ApplicationDiscovery" From 2db3ef8c06470872c818122e29945a55d5f186b1 Mon Sep 17 00:00:00 2001 From: GlennChia Date: Mon, 28 Mar 2022 14:41:41 +0000 Subject: [PATCH 02/17] feat(appint): add generate file and tags_gen --- internal/service/appintegrations/generate.go | 4 + internal/service/appintegrations/tags_gen.go | 95 ++++++++++++++++++++ 2 files changed, 99 insertions(+) create mode 100644 internal/service/appintegrations/generate.go create mode 100644 internal/service/appintegrations/tags_gen.go diff --git a/internal/service/appintegrations/generate.go b/internal/service/appintegrations/generate.go new file mode 100644 index 00000000000..dd558d53a57 --- /dev/null +++ b/internal/service/appintegrations/generate.go @@ -0,0 +1,4 @@ +//go:generate go run ../../generate/tags/main.go -GetTag -ListTags -ServiceTagsMap -UpdateTags +// ONLY generate directives and package declaration! Do not add anything else to this file. + +package appintegrations diff --git a/internal/service/appintegrations/tags_gen.go b/internal/service/appintegrations/tags_gen.go new file mode 100644 index 00000000000..b4230dcd8f4 --- /dev/null +++ b/internal/service/appintegrations/tags_gen.go @@ -0,0 +1,95 @@ +// Code generated by internal/generate/tags/main.go; DO NOT EDIT. +package appintegrations + +import ( + "fmt" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/appintegrationsservice" + tftags "github.com/hashicorp/terraform-provider-aws/internal/tags" + "github.com/hashicorp/terraform-provider-aws/internal/tfresource" +) + +// GetTag fetches an individual appintegrations service tag for a resource. +// Returns whether the key value and any errors. A NotFoundError is used to signal that no value was found. +// This function will optimise the handling over ListTags, if possible. +// The identifier is typically the Amazon Resource Name (ARN), although +// it may also be a different identifier depending on the service. +func GetTag(conn *appintegrationsservice.AppIntegrationsService, identifier string, key string) (*string, error) { + listTags, err := ListTags(conn, identifier) + + if err != nil { + return nil, err + } + + if !listTags.KeyExists(key) { + return nil, tfresource.NewEmptyResultError(nil) + } + + return listTags.KeyValue(key), nil +} + +// ListTags lists appintegrations service tags. +// The identifier is typically the Amazon Resource Name (ARN), although +// it may also be a different identifier depending on the service. +func ListTags(conn *appintegrationsservice.AppIntegrationsService, identifier string) (tftags.KeyValueTags, error) { + input := &appintegrationsservice.ListTagsForResourceInput{ + ResourceArn: aws.String(identifier), + } + + output, err := conn.ListTagsForResource(input) + + if err != nil { + return tftags.New(nil), err + } + + return KeyValueTags(output.Tags), nil +} + +// map[string]*string handling + +// Tags returns appintegrations service tags. +func Tags(tags tftags.KeyValueTags) map[string]*string { + return aws.StringMap(tags.Map()) +} + +// KeyValueTags creates KeyValueTags from appintegrations service tags. +func KeyValueTags(tags map[string]*string) tftags.KeyValueTags { + return tftags.New(tags) +} + +// UpdateTags updates appintegrations service tags. +// The identifier is typically the Amazon Resource Name (ARN), although +// it may also be a different identifier depending on the service. +func UpdateTags(conn *appintegrationsservice.AppIntegrationsService, identifier string, oldTagsMap interface{}, newTagsMap interface{}) error { + oldTags := tftags.New(oldTagsMap) + newTags := tftags.New(newTagsMap) + + if removedTags := oldTags.Removed(newTags); len(removedTags) > 0 { + input := &appintegrationsservice.UntagResourceInput{ + ResourceArn: aws.String(identifier), + TagKeys: aws.StringSlice(removedTags.IgnoreAWS().Keys()), + } + + _, err := conn.UntagResource(input) + + if err != nil { + return fmt.Errorf("error untagging resource (%s): %w", identifier, err) + } + } + + if updatedTags := oldTags.Updated(newTags); len(updatedTags) > 0 { + input := &appintegrationsservice.TagResourceInput{ + ResourceArn: aws.String(identifier), + Tags: Tags(updatedTags.IgnoreAWS()), + } + + _, err := conn.TagResource(input) + + if err != nil { + return fmt.Errorf("error tagging resource (%s): %w", identifier, err) + } + } + + return nil +} From 834fc8f95831229aca83b00e4a2075ccfbd28be8 Mon Sep 17 00:00:00 2001 From: GlennChia Date: Mon, 28 Mar 2022 15:32:40 +0000 Subject: [PATCH 03/17] feat(appint): eventIntegration schema --- .../appintegrations/event_integration.go | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 internal/service/appintegrations/event_integration.go diff --git a/internal/service/appintegrations/event_integration.go b/internal/service/appintegrations/event_integration.go new file mode 100644 index 00000000000..85acad077b4 --- /dev/null +++ b/internal/service/appintegrations/event_integration.go @@ -0,0 +1,58 @@ +package appintegrations + +import ( + "regexp" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + tftags "github.com/hashicorp/terraform-provider-aws/internal/tags" +) + +func ResourceEventIntegration() *schema.Resource { + return &schema.Resource{ + Importer: &schema.ResourceImporter{ + StateContext: schema.ImportStatePassthroughContext, + }, + Schema: map[string]*schema.Schema{ + "arn": { + Type: schema.TypeString, + Computed: true, + }, + "description": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringLenBetween(1, 1000), + }, + "eventbridge_bus": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile(`^[a-zA-Z0-9\/\._\-]{1,255}$`), "should be not be more than 255 alphanumeric, forward slashes, dots, underscores, or hyphen characters"), + }, + "event_filter": { + Type: schema.TypeList, + MaxItems: 1, + Required: true, + ForceNew: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "source": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile(`^aws\.partner\/.*$`), "should be not be more than 255 alphanumeric, forward slashes, dots, underscores, or hyphen characters"), + }, + }, + }, + }, + "name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile(`^[a-zA-Z0-9\/\._\-]{1,255}$`), "should be not be more than 255 alphanumeric, forward slashes, dots, underscores, or hyphen characters"), + }, + "tags": tftags.TagsSchema(), + "tags_all": tftags.TagsSchemaComputed(), + }, + } +} From 13291b84673e85fcc2ffad7fe04e975ff1fcc57b Mon Sep 17 00:00:00 2001 From: GlennChia Date: Mon, 28 Mar 2022 15:34:12 +0000 Subject: [PATCH 04/17] feat(appint): eventIntegration read --- .../appintegrations/event_integration.go | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/internal/service/appintegrations/event_integration.go b/internal/service/appintegrations/event_integration.go index 85acad077b4..69021f82dfb 100644 --- a/internal/service/appintegrations/event_integration.go +++ b/internal/service/appintegrations/event_integration.go @@ -1,15 +1,24 @@ package appintegrations import ( + "context" + "fmt" + "log" "regexp" + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/appintegrationsservice" + "github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2/tfawserr" + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "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" tftags "github.com/hashicorp/terraform-provider-aws/internal/tags" ) func ResourceEventIntegration() *schema.Resource { return &schema.Resource{ + ReadContext: resourceEventIntegrationRead, Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, @@ -56,3 +65,63 @@ func ResourceEventIntegration() *schema.Resource { }, } } + +func resourceEventIntegrationRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + conn := meta.(*conns.AWSClient).AppIntegrationsConn + defaultTagsConfig := meta.(*conns.AWSClient).DefaultTagsConfig + ignoreTagsConfig := meta.(*conns.AWSClient).IgnoreTagsConfig + + name := d.Id() + + resp, err := conn.GetEventIntegrationWithContext(ctx, &appintegrationsservice.GetEventIntegrationInput{ + Name: aws.String(name), + }) + + if !d.IsNewResource() && tfawserr.ErrCodeEquals(err, appintegrationsservice.ErrCodeResourceNotFoundException) { + log.Printf("[WARN] AppIntegrations Event Integration (%s) not found, removing from state", d.Id()) + d.SetId("") + return nil + } + + if err != nil { + return diag.FromErr(fmt.Errorf("error getting AppIntegrations Event Integration (%s): %w", d.Id(), err)) + } + + if resp == nil { + return diag.FromErr(fmt.Errorf("error getting AppIntegrations Event Integration (%s): empty response", d.Id())) + } + + d.Set("arn", resp.EventIntegrationArn) + d.Set("description", resp.Description) + d.Set("eventbridge_bus", resp.EventBridgeBus) + d.Set("name", resp.Name) + + if err := d.Set("event_filter", flattenEventFilter(resp.EventFilter)); err != nil { + return diag.FromErr(fmt.Errorf("error setting event_filter: %w", err)) + } + + tags := KeyValueTags(resp.Tags).IgnoreAWS().IgnoreConfig(ignoreTagsConfig) + + //lintignore:AWSR002 + if err := d.Set("tags", tags.RemoveDefaultConfig(defaultTagsConfig).Map()); err != nil { + return diag.FromErr(fmt.Errorf("error setting tags: %w", err)) + } + + if err := d.Set("tags_all", tags.Map()); err != nil { + return diag.FromErr(fmt.Errorf("error setting tags_all: %w", err)) + } + + return nil +} + +func flattenEventFilter(eventFilter *appintegrationsservice.EventFilter) []interface{} { + if eventFilter == nil { + return []interface{}{} + } + + values := map[string]interface{}{ + "source": aws.StringValue(eventFilter.Source), + } + + return []interface{}{values} +} From 693761af5433f2feb87cb2b6c2954f7c266de549 Mon Sep 17 00:00:00 2001 From: GlennChia Date: Mon, 28 Mar 2022 15:35:09 +0000 Subject: [PATCH 05/17] feat(appint): eventIntegration create --- .../appintegrations/event_integration.go | 60 ++++++++++++++++++- 1 file changed, 59 insertions(+), 1 deletion(-) diff --git a/internal/service/appintegrations/event_integration.go b/internal/service/appintegrations/event_integration.go index 69021f82dfb..6e389e010e4 100644 --- a/internal/service/appintegrations/event_integration.go +++ b/internal/service/appintegrations/event_integration.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go/service/appintegrationsservice" "github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2/tfawserr" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "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" @@ -18,7 +19,8 @@ import ( func ResourceEventIntegration() *schema.Resource { return &schema.Resource{ - ReadContext: resourceEventIntegrationRead, + CreateContext: resourceEventIntegrationCreate, + ReadContext: resourceEventIntegrationRead, Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, @@ -66,6 +68,45 @@ func ResourceEventIntegration() *schema.Resource { } } +func resourceEventIntegrationCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + conn := meta.(*conns.AWSClient).AppIntegrationsConn + defaultTagsConfig := meta.(*conns.AWSClient).DefaultTagsConfig + tags := defaultTagsConfig.MergeTags(tftags.New(d.Get("tags").(map[string]interface{}))) + + name := d.Get("name").(string) + + input := &appintegrationsservice.CreateEventIntegrationInput{ + ClientToken: aws.String(resource.UniqueId()), + EventBridgeBus: aws.String(d.Get("eventbridge_bus").(string)), + EventFilter: expandEventFilter(d.Get("event_filter").([]interface{})), + Name: aws.String(name), + } + + if v, ok := d.GetOk("description"); ok { + input.Description = aws.String(v.(string)) + } + + if len(tags) > 0 { + input.Tags = Tags(tags.IgnoreAWS()) + } + + log.Printf("[DEBUG] Creating AppIntegrations Event Integration %s", input) + output, err := conn.CreateEventIntegrationWithContext(ctx, input) + + if err != nil { + return diag.FromErr(fmt.Errorf("error creating AppIntegrations Event Integration (%s): %w", name, err)) + } + + if output == nil { + return diag.FromErr(fmt.Errorf("error creating AppIntegrations Event Integration (%s): empty output", name)) + } + + // Name is unique + d.SetId(name) + + return resourceEventIntegrationRead(ctx, d, meta) +} + func resourceEventIntegrationRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { conn := meta.(*conns.AWSClient).AppIntegrationsConn defaultTagsConfig := meta.(*conns.AWSClient).DefaultTagsConfig @@ -114,6 +155,23 @@ func resourceEventIntegrationRead(ctx context.Context, d *schema.ResourceData, m return nil } +func expandEventFilter(eventFilter []interface{}) *appintegrationsservice.EventFilter { + if len(eventFilter) == 0 || eventFilter[0] == nil { + return nil + } + + tfMap, ok := eventFilter[0].(map[string]interface{}) + if !ok { + return nil + } + + result := &appintegrationsservice.EventFilter{ + Source: aws.String(tfMap["source"].(string)), + } + + return result +} + func flattenEventFilter(eventFilter *appintegrationsservice.EventFilter) []interface{} { if eventFilter == nil { return []interface{}{} From fd03caefbea83acbf51e9506ec932747213c706c Mon Sep 17 00:00:00 2001 From: GlennChia Date: Mon, 28 Mar 2022 15:35:46 +0000 Subject: [PATCH 06/17] feat(appint): eventIntegration update --- .../appintegrations/event_integration.go | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/internal/service/appintegrations/event_integration.go b/internal/service/appintegrations/event_integration.go index 6e389e010e4..7ba5ee3c021 100644 --- a/internal/service/appintegrations/event_integration.go +++ b/internal/service/appintegrations/event_integration.go @@ -21,6 +21,7 @@ func ResourceEventIntegration() *schema.Resource { return &schema.Resource{ CreateContext: resourceEventIntegrationCreate, ReadContext: resourceEventIntegrationRead, + UpdateContext: resourceEventIntegrationUpdate, Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, @@ -155,6 +156,32 @@ func resourceEventIntegrationRead(ctx context.Context, d *schema.ResourceData, m return nil } +func resourceEventIntegrationUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + conn := meta.(*conns.AWSClient).AppIntegrationsConn + + name := d.Id() + + if d.HasChange("description") { + _, err := conn.UpdateEventIntegrationWithContext(ctx, &appintegrationsservice.UpdateEventIntegrationInput{ + Name: aws.String(name), + Description: aws.String(d.Get("description").(string)), + }) + + if err != nil { + return diag.FromErr(fmt.Errorf("[ERROR] Error updating EventIntegration (%s): %w", d.Id(), err)) + } + } + + if d.HasChange("tags_all") { + o, n := d.GetChange("tags_all") + if err := UpdateTags(conn, d.Get("arn").(string), o, n); err != nil { + return diag.FromErr(fmt.Errorf("error updating tags: %w", err)) + } + } + + return resourceEventIntegrationRead(ctx, d, meta) +} + func expandEventFilter(eventFilter []interface{}) *appintegrationsservice.EventFilter { if len(eventFilter) == 0 || eventFilter[0] == nil { return nil From 9dd50a3b397a7adc03cad15c45699f485fb3817e Mon Sep 17 00:00:00 2001 From: GlennChia Date: Mon, 28 Mar 2022 15:36:53 +0000 Subject: [PATCH 07/17] feat(appint): eventIntegration delete --- .../appintegrations/event_integration.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/internal/service/appintegrations/event_integration.go b/internal/service/appintegrations/event_integration.go index 7ba5ee3c021..762def226e6 100644 --- a/internal/service/appintegrations/event_integration.go +++ b/internal/service/appintegrations/event_integration.go @@ -22,6 +22,7 @@ func ResourceEventIntegration() *schema.Resource { CreateContext: resourceEventIntegrationCreate, ReadContext: resourceEventIntegrationRead, UpdateContext: resourceEventIntegrationUpdate, + DeleteContext: resourceEventIntegrationDelete, Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, @@ -182,6 +183,22 @@ func resourceEventIntegrationUpdate(ctx context.Context, d *schema.ResourceData, return resourceEventIntegrationRead(ctx, d, meta) } +func resourceEventIntegrationDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + conn := meta.(*conns.AWSClient).AppIntegrationsConn + + name := d.Id() + + _, err := conn.DeleteEventIntegrationWithContext(ctx, &appintegrationsservice.DeleteEventIntegrationInput{ + Name: aws.String(name), + }) + + if err != nil { + return diag.FromErr(fmt.Errorf("error deleting EventIntegration (%s): %w", d.Id(), err)) + } + + return nil +} + func expandEventFilter(eventFilter []interface{}) *appintegrationsservice.EventFilter { if len(eventFilter) == 0 || eventFilter[0] == nil { return nil From 99a14378df67abf868cc94feb065e4415032cd4f Mon Sep 17 00:00:00 2001 From: GlennChia Date: Mon, 28 Mar 2022 15:37:02 +0000 Subject: [PATCH 08/17] feat(appint): add eventIntegration to provider --- internal/provider/provider.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/provider/provider.go b/internal/provider/provider.go index 81431003dbd..1c5ddf3e21d 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -23,6 +23,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/service/apigatewayv2" "github.com/hashicorp/terraform-provider-aws/internal/service/appautoscaling" "github.com/hashicorp/terraform-provider-aws/internal/service/appconfig" + "github.com/hashicorp/terraform-provider-aws/internal/service/appintegrations" "github.com/hashicorp/terraform-provider-aws/internal/service/appmesh" "github.com/hashicorp/terraform-provider-aws/internal/service/apprunner" "github.com/hashicorp/terraform-provider-aws/internal/service/appstream" @@ -927,6 +928,8 @@ func Provider() *schema.Provider { "aws_appautoscaling_scheduled_action": appautoscaling.ResourceScheduledAction(), "aws_appautoscaling_target": appautoscaling.ResourceTarget(), + "aws_appintegrations_event_integration": appintegrations.ResourceEventIntegration(), + "aws_appmesh_gateway_route": appmesh.ResourceGatewayRoute(), "aws_appmesh_mesh": appmesh.ResourceMesh(), "aws_appmesh_route": appmesh.ResourceRoute(), From 7e2c1554bcf59c14a309af2c558f19e572cb3665 Mon Sep 17 00:00:00 2001 From: GlennChia Date: Mon, 28 Mar 2022 15:37:54 +0000 Subject: [PATCH 09/17] test(appint): eventIntegration basic update desc --- .../appintegrations/event_integration_test.go | 136 ++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 internal/service/appintegrations/event_integration_test.go diff --git a/internal/service/appintegrations/event_integration_test.go b/internal/service/appintegrations/event_integration_test.go new file mode 100644 index 00000000000..4d2c8dda43c --- /dev/null +++ b/internal/service/appintegrations/event_integration_test.go @@ -0,0 +1,136 @@ +package appintegrations_test + +import ( + "fmt" + "os" + "testing" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/appintegrationsservice" + sdkacctest "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-provider-aws/internal/acctest" + "github.com/hashicorp/terraform-provider-aws/internal/conns" +) + +func TestAccEventIntegration_basic(t *testing.T) { + var eventIntegration appintegrationsservice.GetEventIntegrationOutput + + rName := sdkacctest.RandomWithPrefix("resource-test-terraform") + originalDescription := "original description" + updatedDescription := "updated description" + resourceName := "aws_appintegrations_event_integration.test" + + key := "EVENT_BRIDGE_PARTNER_EVENT_SOURCE_NAME" + var sourceName string + sourceName = os.Getenv(key) + if sourceName == "" { + sourceName = "aws.partner/examplepartner.com" + } + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(t) }, + ErrorCheck: acctest.ErrorCheck(t, appintegrationsservice.EndpointsID), + Providers: acctest.Providers, + CheckDestroy: testAccCheckEventIntegrationDestroy, + Steps: []resource.TestStep{ + { + Config: testAccEventIntegrationConfig_basic(rName, originalDescription, sourceName), + Check: resource.ComposeTestCheckFunc( + testAccCheckEventIntegrationExists(resourceName, &eventIntegration), + resource.TestCheckResourceAttrSet(resourceName, "arn"), + resource.TestCheckResourceAttr(resourceName, "description", originalDescription), + resource.TestCheckResourceAttr(resourceName, "eventbridge_bus", "default"), + resource.TestCheckResourceAttr(resourceName, "event_filter.#", "1"), + resource.TestCheckResourceAttr(resourceName, "event_filter.0.source", sourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.Name", "Test Event Integration"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + { + Config: testAccEventIntegrationConfig_basic(rName, updatedDescription, sourceName), + Check: resource.ComposeTestCheckFunc( + testAccCheckEventIntegrationExists(resourceName, &eventIntegration), + resource.TestCheckResourceAttrSet(resourceName, "arn"), + resource.TestCheckResourceAttr(resourceName, "description", updatedDescription), + resource.TestCheckResourceAttr(resourceName, "eventbridge_bus", "default"), + resource.TestCheckResourceAttr(resourceName, "event_filter.#", "1"), + resource.TestCheckResourceAttr(resourceName, "event_filter.0.source", "aws.partner/examplepartner.com"), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.Name", "Test Event Integration"), + ), + }, + }, + }) +} + +func testAccCheckEventIntegrationDestroy(s *terraform.State) error { + conn := acctest.Provider.Meta().(*conns.AWSClient).AppIntegrationsConn + for _, rs := range s.RootModule().Resources { + if rs.Type != "aws_appintegrations_event_integration" { + continue + } + + input := &appintegrationsservice.GetEventIntegrationInput{ + Name: aws.String(rs.Primary.ID), + } + + resp, err := conn.GetEventIntegration(input) + + if err == nil { + if aws.StringValue(resp.Name) == rs.Primary.ID { + return fmt.Errorf("Event Integration '%s' was not deleted properly", rs.Primary.ID) + } + } + } + + return nil +} + +func testAccCheckEventIntegrationExists(name string, eventIntegration *appintegrationsservice.GetEventIntegrationOutput) resource.TestCheckFunc { + return func(s *terraform.State) error { + rs, ok := s.RootModule().Resources[name] + + if !ok { + return fmt.Errorf("Not found: %s", name) + } + + conn := acctest.Provider.Meta().(*conns.AWSClient).AppIntegrationsConn + input := &appintegrationsservice.GetEventIntegrationInput{ + Name: aws.String(rs.Primary.ID), + } + resp, err := conn.GetEventIntegration(input) + + if err != nil { + return err + } + + *eventIntegration = *resp + + return nil + } +} + +func testAccEventIntegrationConfig_basic(rName, label, sourceName string) string { + return fmt.Sprintf(` +resource "aws_appintegrations_event_integration" "test" { + name = %[1]q + description = %[2]q + eventbridge_bus = "default" + + event_filter { + source = %[3]q + } + + tags = { + "Name" = "Test Event Integration" + } +} +`, rName, label, sourceName) +} From 24d4ea3b779db24c738ddebf22bf53c62530dd99 Mon Sep 17 00:00:00 2001 From: GlennChia Date: Mon, 28 Mar 2022 15:39:22 +0000 Subject: [PATCH 10/17] test(appint): eventIntegration disappears --- .../appintegrations/event_integration_test.go | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/internal/service/appintegrations/event_integration_test.go b/internal/service/appintegrations/event_integration_test.go index 4d2c8dda43c..643e53d24df 100644 --- a/internal/service/appintegrations/event_integration_test.go +++ b/internal/service/appintegrations/event_integration_test.go @@ -12,6 +12,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-aws/internal/acctest" "github.com/hashicorp/terraform-provider-aws/internal/conns" + tfappintegrations "github.com/hashicorp/terraform-provider-aws/internal/service/appintegrations" ) func TestAccEventIntegration_basic(t *testing.T) { @@ -70,6 +71,38 @@ func TestAccEventIntegration_basic(t *testing.T) { }) } +func TestAccEventIntegration_disappears(t *testing.T) { + var eventIntegration appintegrationsservice.GetEventIntegrationOutput + + rName := sdkacctest.RandomWithPrefix("resource-test-terraform") + description := "disappears" + resourceName := "aws_appintegrations_event_integration.test" + + key := "EVENT_BRIDGE_PARTNER_EVENT_SOURCE_NAME" + var sourceName string + sourceName = os.Getenv(key) + if sourceName == "" { + sourceName = "aws.partner/examplepartner.com" + } + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(t) }, + ErrorCheck: acctest.ErrorCheck(t, appintegrationsservice.EndpointsID), + Providers: acctest.Providers, + CheckDestroy: testAccCheckEventIntegrationDestroy, + Steps: []resource.TestStep{ + { + Config: testAccEventIntegrationConfig_basic(rName, description, sourceName), + Check: resource.ComposeTestCheckFunc( + testAccCheckEventIntegrationExists(resourceName, &eventIntegration), + acctest.CheckResourceDisappears(acctest.Provider, tfappintegrations.ResourceEventIntegration(), resourceName), + ), + ExpectNonEmptyPlan: true, + }, + }, + }) +} + func testAccCheckEventIntegrationDestroy(s *terraform.State) error { conn := acctest.Provider.Meta().(*conns.AWSClient).AppIntegrationsConn for _, rs := range s.RootModule().Resources { From 942343762a942e6c6bcd8b9d0d9fdf59e5ff3ec0 Mon Sep 17 00:00:00 2001 From: GlennChia Date: Mon, 28 Mar 2022 15:39:57 +0000 Subject: [PATCH 11/17] test(appint): eventIntegration update tags --- .../appintegrations/event_integration_test.go | 115 ++++++++++++++++++ 1 file changed, 115 insertions(+) diff --git a/internal/service/appintegrations/event_integration_test.go b/internal/service/appintegrations/event_integration_test.go index 643e53d24df..4f34fe2f89c 100644 --- a/internal/service/appintegrations/event_integration_test.go +++ b/internal/service/appintegrations/event_integration_test.go @@ -71,6 +71,82 @@ func TestAccEventIntegration_basic(t *testing.T) { }) } +func TestAccEventIntegration_updateTags(t *testing.T) { + var eventIntegration appintegrationsservice.GetEventIntegrationOutput + + rName := sdkacctest.RandomWithPrefix("resource-test-terraform") + description := "example description" + resourceName := "aws_appintegrations_event_integration.test" + + key := "EVENT_BRIDGE_PARTNER_EVENT_SOURCE_NAME" + var sourceName string + sourceName = os.Getenv(key) + if sourceName == "" { + sourceName = "aws.partner/examplepartner.com" + } + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(t) }, + ErrorCheck: acctest.ErrorCheck(t, appintegrationsservice.EndpointsID), + Providers: acctest.Providers, + CheckDestroy: testAccCheckEventIntegrationDestroy, + Steps: []resource.TestStep{ + { + Config: testAccEventIntegrationConfig_basic(rName, description, sourceName), + Check: resource.ComposeTestCheckFunc( + testAccCheckEventIntegrationExists(resourceName, &eventIntegration), + resource.TestCheckResourceAttrSet(resourceName, "arn"), + resource.TestCheckResourceAttr(resourceName, "description", description), + resource.TestCheckResourceAttr(resourceName, "eventbridge_bus", "default"), + resource.TestCheckResourceAttr(resourceName, "event_filter.#", "1"), + resource.TestCheckResourceAttr(resourceName, "event_filter.0.source", sourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.Name", "Test Event Integration"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + { + Config: testAccEventIntegrationConfig_tags(rName, description, sourceName), + Check: resource.ComposeTestCheckFunc( + testAccCheckEventIntegrationExists(resourceName, &eventIntegration), + resource.TestCheckResourceAttrSet(resourceName, "arn"), + resource.TestCheckResourceAttr(resourceName, "description", description), + resource.TestCheckResourceAttr(resourceName, "eventbridge_bus", "default"), + resource.TestCheckResourceAttr(resourceName, "event_filter.#", "1"), + resource.TestCheckResourceAttr(resourceName, "event_filter.0.source", sourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags.Name", "Test Event Integration"), + resource.TestCheckResourceAttr(resourceName, "tags.Key2", "Value2a"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + { + Config: testAccEventIntegrationConfig_tagsUpdated(rName, description, sourceName), + Check: resource.ComposeTestCheckFunc( + testAccCheckEventIntegrationExists(resourceName, &eventIntegration), + resource.TestCheckResourceAttrSet(resourceName, "arn"), + resource.TestCheckResourceAttr(resourceName, "description", description), + resource.TestCheckResourceAttr(resourceName, "eventbridge_bus", "default"), + resource.TestCheckResourceAttr(resourceName, "event_filter.#", "1"), + resource.TestCheckResourceAttr(resourceName, "event_filter.0.source", sourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "3"), + resource.TestCheckResourceAttr(resourceName, "tags.Name", "Test Event Integration"), + resource.TestCheckResourceAttr(resourceName, "tags.Key2", "Value2b"), + resource.TestCheckResourceAttr(resourceName, "tags.Key3", "Value3"), + ), + }, + }, + }) +} + func TestAccEventIntegration_disappears(t *testing.T) { var eventIntegration appintegrationsservice.GetEventIntegrationOutput @@ -167,3 +243,42 @@ resource "aws_appintegrations_event_integration" "test" { } `, rName, label, sourceName) } + +func testAccEventIntegrationConfig_tags(rName, label, sourceName string) string { + return fmt.Sprintf(` +resource "aws_appintegrations_event_integration" "test" { + name = %[1]q + description = %[2]q + eventbridge_bus = "default" + + event_filter { + source = %[3]q + } + + tags = { + "Name" = "Test Event Integration" + "Key2" = "Value2a" + } +} +`, rName, label, sourceName) +} + +func testAccEventIntegrationConfig_tagsUpdated(rName, label, sourceName string) string { + return fmt.Sprintf(` +resource "aws_appintegrations_event_integration" "test" { + name = %[1]q + description = %[2]q + eventbridge_bus = "default" + + event_filter { + source = %[3]q + } + + tags = { + "Name" = "Test Event Integration" + "Key2" = "Value2b" + "Key3" = "Value3" + } +} +`, rName, label, sourceName) +} From f3bbdb488eb0d951f66e83e2a0edf77ae6f2d148 Mon Sep 17 00:00:00 2001 From: GlennChia Date: Mon, 28 Mar 2022 15:52:15 +0000 Subject: [PATCH 12/17] docs(appint): add eventIntegration resource doc --- ...tegrations_event_integration.html.markdown | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 website/docs/r/appintegrations_event_integration.html.markdown diff --git a/website/docs/r/appintegrations_event_integration.html.markdown b/website/docs/r/appintegrations_event_integration.html.markdown new file mode 100644 index 00000000000..bcf949ab4e0 --- /dev/null +++ b/website/docs/r/appintegrations_event_integration.html.markdown @@ -0,0 +1,59 @@ +--- +subcategory: "AppIntegrations" +layout: "aws" +page_title: "AWS: aws_appintegrations_event_integration" +description: |- + Provides details about a specific Amazon AppIntegrations Event Integration +--- + +# Resource: aws_appintegrations_event_integration + +Provides an Amazon AppIntegrations Event Integration resource. + +## Example Usage + +```terraform +resource "aws_appintegrations_event_integration" "example" { + name = "example-name" + description = "Example Description" + eventbridge_bus = "default" + + event_filter { + source = "aws.partner/examplepartner.com" + } + + tags = { + "Name" = "Example Event Integration" + } +} +``` + +## Argument Reference + +The following arguments are supported: + +* `description` - (Optional) Specifies the description of the Event Integration. +* `eventbridge_bus` - (Required) Specifies the EventBridge bus. +* `event_filter` - (Required) A block that defines the configuration information for the event filter. The Event Filter block is documented below. +* `name` - (Required) Specifies the name of the Event Integration. +* `tags` - (Optional) Tags to apply to the Event Integration. If configured with a provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. + +A `event_filter` block supports the following arguments: + +* `source` - (Required) The source of the events. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `arn` - The Amazon Resource Name (ARN) of the Event Integration. +* `id` - The identifier of the Event Integration which is the name of the Event Integration. +* `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block). + +## Import + +Amazon AppIntegrations Event Integrations can be imported using the `name` e.g., + +``` +$ terraform import aws_appintegrations_event_integration.example example-name +``` From 63f3e5a316a4406603ee400044554a0ebb8451eb Mon Sep 17 00:00:00 2001 From: GlennChia Date: Mon, 28 Mar 2022 16:07:06 +0000 Subject: [PATCH 13/17] ci(appint): add changelog for eventIntegration --- .changelog/23904.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/23904.txt diff --git a/.changelog/23904.txt b/.changelog/23904.txt new file mode 100644 index 00000000000..d52bf91794a --- /dev/null +++ b/.changelog/23904.txt @@ -0,0 +1,3 @@ +```release-note:new-resource +aws_appintegrations_event_integration +``` \ No newline at end of file From ec74e68fa5ba4528d5e9122e0f5b793b6c79b6c9 Mon Sep 17 00:00:00 2001 From: GlennChia Date: Tue, 29 Mar 2022 00:45:18 +0000 Subject: [PATCH 14/17] fix(appint): add CustomizeDiff to fix update tags CustomizeDiff: verify.SetTagsDiff, --- internal/service/appintegrations/event_integration.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/internal/service/appintegrations/event_integration.go b/internal/service/appintegrations/event_integration.go index 762def226e6..4194a7d9e2c 100644 --- a/internal/service/appintegrations/event_integration.go +++ b/internal/service/appintegrations/event_integration.go @@ -15,6 +15,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/hashicorp/terraform-provider-aws/internal/conns" tftags "github.com/hashicorp/terraform-provider-aws/internal/tags" + "github.com/hashicorp/terraform-provider-aws/internal/verify" ) func ResourceEventIntegration() *schema.Resource { @@ -67,6 +68,7 @@ func ResourceEventIntegration() *schema.Resource { "tags": tftags.TagsSchema(), "tags_all": tftags.TagsSchemaComputed(), }, + CustomizeDiff: verify.SetTagsDiff, } } From 990482956d6cd7ce609be74d6d1a06129ed50947 Mon Sep 17 00:00:00 2001 From: GlennChia Date: Tue, 29 Mar 2022 14:15:36 +0000 Subject: [PATCH 15/17] test(appint): change sourceName to point to var --- internal/service/appintegrations/event_integration_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/appintegrations/event_integration_test.go b/internal/service/appintegrations/event_integration_test.go index 4f34fe2f89c..46e3a280ddb 100644 --- a/internal/service/appintegrations/event_integration_test.go +++ b/internal/service/appintegrations/event_integration_test.go @@ -62,7 +62,7 @@ func TestAccEventIntegration_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "description", updatedDescription), resource.TestCheckResourceAttr(resourceName, "eventbridge_bus", "default"), resource.TestCheckResourceAttr(resourceName, "event_filter.#", "1"), - resource.TestCheckResourceAttr(resourceName, "event_filter.0.source", "aws.partner/examplepartner.com"), + resource.TestCheckResourceAttr(resourceName, "event_filter.0.source", sourceName), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), resource.TestCheckResourceAttr(resourceName, "tags.Name", "Test Event Integration"), ), From e6c7bc4b50db1f9c204af8b04a392667ecae3ceb Mon Sep 17 00:00:00 2001 From: GlennChia Date: Fri, 15 Apr 2022 14:08:01 +0000 Subject: [PATCH 16/17] chore(appint): rm unused flags from generate go --- internal/service/appintegrations/generate.go | 2 +- internal/service/appintegrations/tags_gen.go | 37 -------------------- 2 files changed, 1 insertion(+), 38 deletions(-) diff --git a/internal/service/appintegrations/generate.go b/internal/service/appintegrations/generate.go index dd558d53a57..9950430a4bb 100644 --- a/internal/service/appintegrations/generate.go +++ b/internal/service/appintegrations/generate.go @@ -1,4 +1,4 @@ -//go:generate go run ../../generate/tags/main.go -GetTag -ListTags -ServiceTagsMap -UpdateTags +//go:generate go run ../../generate/tags/main.go -ServiceTagsMap -UpdateTags // ONLY generate directives and package declaration! Do not add anything else to this file. package appintegrations diff --git a/internal/service/appintegrations/tags_gen.go b/internal/service/appintegrations/tags_gen.go index b4230dcd8f4..8ffc2baafe2 100644 --- a/internal/service/appintegrations/tags_gen.go +++ b/internal/service/appintegrations/tags_gen.go @@ -7,45 +7,8 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/appintegrationsservice" tftags "github.com/hashicorp/terraform-provider-aws/internal/tags" - "github.com/hashicorp/terraform-provider-aws/internal/tfresource" ) -// GetTag fetches an individual appintegrations service tag for a resource. -// Returns whether the key value and any errors. A NotFoundError is used to signal that no value was found. -// This function will optimise the handling over ListTags, if possible. -// The identifier is typically the Amazon Resource Name (ARN), although -// it may also be a different identifier depending on the service. -func GetTag(conn *appintegrationsservice.AppIntegrationsService, identifier string, key string) (*string, error) { - listTags, err := ListTags(conn, identifier) - - if err != nil { - return nil, err - } - - if !listTags.KeyExists(key) { - return nil, tfresource.NewEmptyResultError(nil) - } - - return listTags.KeyValue(key), nil -} - -// ListTags lists appintegrations service tags. -// The identifier is typically the Amazon Resource Name (ARN), although -// it may also be a different identifier depending on the service. -func ListTags(conn *appintegrationsservice.AppIntegrationsService, identifier string) (tftags.KeyValueTags, error) { - input := &appintegrationsservice.ListTagsForResourceInput{ - ResourceArn: aws.String(identifier), - } - - output, err := conn.ListTagsForResource(input) - - if err != nil { - return tftags.New(nil), err - } - - return KeyValueTags(output.Tags), nil -} - // map[string]*string handling // Tags returns appintegrations service tags. From 7087927d5d130032507fb21a757e04c0a001f5db Mon Sep 17 00:00:00 2001 From: Simon Davis Date: Thu, 12 May 2022 11:33:40 -0700 Subject: [PATCH 17/17] add partition prechecks --- internal/provider/provider.go | 8 ++++---- .../appintegrations/event_integration_test.go | 17 ++++++++++++----- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/internal/provider/provider.go b/internal/provider/provider.go index f3299c14f30..dae9ada095f 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -25,7 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/service/apigatewayv2" "github.com/hashicorp/terraform-provider-aws/internal/service/appautoscaling" "github.com/hashicorp/terraform-provider-aws/internal/service/appconfig" - "github.com/hashicorp/terraform-provider-aws/internal/service/appflow" + "github.com/hashicorp/terraform-provider-aws/internal/service/appflow" "github.com/hashicorp/terraform-provider-aws/internal/service/appintegrations" "github.com/hashicorp/terraform-provider-aws/internal/service/appmesh" "github.com/hashicorp/terraform-provider-aws/internal/service/apprunner" @@ -958,10 +958,10 @@ func Provider() *schema.Provider { "aws_appautoscaling_policy": appautoscaling.ResourcePolicy(), "aws_appautoscaling_scheduled_action": appautoscaling.ResourceScheduledAction(), "aws_appautoscaling_target": appautoscaling.ResourceTarget(), - + "aws_appflow_flow": appflow.ResourceFlow(), - - "aws_appintegrations_event_integration": appintegrations.ResourceEventIntegration(), + + "aws_appintegrations_event_integration": appintegrations.ResourceEventIntegration(), "aws_appmesh_gateway_route": appmesh.ResourceGatewayRoute(), "aws_appmesh_mesh": appmesh.ResourceMesh(), diff --git a/internal/service/appintegrations/event_integration_test.go b/internal/service/appintegrations/event_integration_test.go index 46e3a280ddb..d3231f57b25 100644 --- a/internal/service/appintegrations/event_integration_test.go +++ b/internal/service/appintegrations/event_integration_test.go @@ -31,7 +31,10 @@ func TestAccEventIntegration_basic(t *testing.T) { } resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { acctest.PreCheck(t) }, + PreCheck: func() { + acctest.PreCheck(t) + acctest.PreCheckPartitionHasService(appintegrationsservice.EndpointsID, t) + }, ErrorCheck: acctest.ErrorCheck(t, appintegrationsservice.EndpointsID), Providers: acctest.Providers, CheckDestroy: testAccCheckEventIntegrationDestroy, @@ -86,8 +89,10 @@ func TestAccEventIntegration_updateTags(t *testing.T) { } resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { acctest.PreCheck(t) }, - ErrorCheck: acctest.ErrorCheck(t, appintegrationsservice.EndpointsID), + PreCheck: func() { + acctest.PreCheck(t) + acctest.PreCheckPartitionHasService(appintegrationsservice.EndpointsID, t) + }, ErrorCheck: acctest.ErrorCheck(t, appintegrationsservice.EndpointsID), Providers: acctest.Providers, CheckDestroy: testAccCheckEventIntegrationDestroy, Steps: []resource.TestStep{ @@ -162,8 +167,10 @@ func TestAccEventIntegration_disappears(t *testing.T) { } resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { acctest.PreCheck(t) }, - ErrorCheck: acctest.ErrorCheck(t, appintegrationsservice.EndpointsID), + PreCheck: func() { + acctest.PreCheck(t) + acctest.PreCheckPartitionHasService(appintegrationsservice.EndpointsID, t) + }, ErrorCheck: acctest.ErrorCheck(t, appintegrationsservice.EndpointsID), Providers: acctest.Providers, CheckDestroy: testAccCheckEventIntegrationDestroy, Steps: []resource.TestStep{