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 diff --git a/internal/provider/provider.go b/internal/provider/provider.go index de57c76deb2..9455b2c110a 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -26,6 +26,7 @@ import ( "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/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" @@ -962,6 +963,8 @@ func Provider() *schema.Provider { "aws_appflow_flow": appflow.ResourceFlow(), + "aws_appintegrations_event_integration": appintegrations.ResourceEventIntegration(), + "aws_appmesh_gateway_route": appmesh.ResourceGatewayRoute(), "aws_appmesh_mesh": appmesh.ResourceMesh(), "aws_appmesh_route": appmesh.ResourceRoute(), diff --git a/internal/service/appintegrations/event_integration.go b/internal/service/appintegrations/event_integration.go new file mode 100644 index 00000000000..4194a7d9e2c --- /dev/null +++ b/internal/service/appintegrations/event_integration.go @@ -0,0 +1,231 @@ +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/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" + tftags "github.com/hashicorp/terraform-provider-aws/internal/tags" + "github.com/hashicorp/terraform-provider-aws/internal/verify" +) + +func ResourceEventIntegration() *schema.Resource { + return &schema.Resource{ + CreateContext: resourceEventIntegrationCreate, + ReadContext: resourceEventIntegrationRead, + UpdateContext: resourceEventIntegrationUpdate, + DeleteContext: resourceEventIntegrationDelete, + 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(), + }, + CustomizeDiff: verify.SetTagsDiff, + } +} + +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 + 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 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 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 + } + + 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{}{} + } + + values := map[string]interface{}{ + "source": aws.StringValue(eventFilter.Source), + } + + return []interface{}{values} +} diff --git a/internal/service/appintegrations/event_integration_test.go b/internal/service/appintegrations/event_integration_test.go new file mode 100644 index 00000000000..d3231f57b25 --- /dev/null +++ b/internal/service/appintegrations/event_integration_test.go @@ -0,0 +1,291 @@ +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" + tfappintegrations "github.com/hashicorp/terraform-provider-aws/internal/service/appintegrations" +) + +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) + acctest.PreCheckPartitionHasService(appintegrationsservice.EndpointsID, 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", sourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.Name", "Test Event Integration"), + ), + }, + }, + }) +} + +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) + acctest.PreCheckPartitionHasService(appintegrationsservice.EndpointsID, 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 + + 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) + acctest.PreCheckPartitionHasService(appintegrationsservice.EndpointsID, 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 { + 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) +} + +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) +} diff --git a/internal/service/appintegrations/generate.go b/internal/service/appintegrations/generate.go new file mode 100644 index 00000000000..9950430a4bb --- /dev/null +++ b/internal/service/appintegrations/generate.go @@ -0,0 +1,4 @@ +//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 new file mode 100644 index 00000000000..8ffc2baafe2 --- /dev/null +++ b/internal/service/appintegrations/tags_gen.go @@ -0,0 +1,58 @@ +// 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" +) + +// 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 +} 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 +```