Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

r/kinesisanalyticsv2_application: add application_mode attribute #37714

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/37714.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/aws_kinesisanalyticsv2_application: Add `application_mode` argument
```
13 changes: 13 additions & 0 deletions internal/service/kinesisanalyticsv2/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,14 @@ func ResourceApplication() *schema.Resource {
Computed: true,
},

"application_mode": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
ValidateFunc: validation.StringInSlice(kinesisanalyticsv2.ApplicationMode_Values(), false),
},

"cloudwatch_logging_options": {
Type: schema.TypeList,
Optional: true,
Expand Down Expand Up @@ -949,6 +957,10 @@ func resourceApplicationCreate(ctx context.Context, d *schema.ResourceData, meta
Tags: getTagsIn(ctx),
}

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

outputRaw, err := waitIAMPropagation(ctx, func() (interface{}, error) {
return conn.CreateApplicationWithContext(ctx, input)
})
Expand Down Expand Up @@ -992,6 +1004,7 @@ func resourceApplicationRead(ctx context.Context, d *schema.ResourceData, meta i
d.Set(names.AttrARN, arn)
d.Set("create_timestamp", aws.TimeValue(application.CreateTimestamp).Format(time.RFC3339))
d.Set(names.AttrDescription, application.ApplicationDescription)
d.Set("application_mode", application.ApplicationMode)
d.Set("last_update_timestamp", aws.TimeValue(application.LastUpdateTimestamp).Format(time.RFC3339))
d.Set(names.AttrName, application.ApplicationName)
d.Set("runtime_environment", application.RuntimeEnvironment)
Expand Down
41 changes: 41 additions & 0 deletions internal/service/kinesisanalyticsv2/application_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,34 @@ func TestAccKinesisAnalyticsV2Application_basicSQLApplication(t *testing.T) {
})
}

func TestAccKinesisAnalyticsV2Application_applicationMode(t *testing.T) {
ctx := acctest.Context(t)
var v kinesisanalyticsv2.ApplicationDetail
resourceName := "aws_kinesisanalyticsv2_application.test"
rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix)

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { acctest.PreCheck(ctx, t); testAccPreCheck(ctx, t) },
ErrorCheck: acctest.ErrorCheck(t, names.KinesisAnalyticsV2ServiceID),
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories,
CheckDestroy: testAccCheckApplicationDestroy(ctx),
Steps: []resource.TestStep{
{
Config: testAccApplicationConfig_applicationMode(rName),
Check: resource.ComposeTestCheckFunc(
testAccCheckApplicationExists(ctx, resourceName, &v),
resource.TestCheckResourceAttr(resourceName, "application_mode", "STREAMING"),
),
},
{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
},
},
})
}

func TestAccKinesisAnalyticsV2Application_disappears(t *testing.T) {
ctx := acctest.Context(t)
var v kinesisanalyticsv2.ApplicationDetail
Expand Down Expand Up @@ -4487,6 +4515,19 @@ resource "aws_kinesisanalyticsv2_application" "test" {
`, rName))
}

func testAccApplicationConfig_applicationMode(rName string) string {
return acctest.ConfigCompose(
testAccApplicationConfig_baseServiceExecutionIAMRole(rName),
fmt.Sprintf(`
resource "aws_kinesisanalyticsv2_application" "test" {
name = %[1]q
application_mode = "STREAMING"
runtime_environment = "FLINK-1_13"
service_execution_role = aws_iam_role.test[0].arn
}
`, rName))
}

func testAccApplicationConfig_basicSQLPlusDescription(rName string) string {
return acctest.ConfigCompose(
testAccApplicationConfig_baseServiceExecutionIAMRole(rName),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ This resource supports the following arguments:
* `runtime_environment` - (Required) The runtime environment for the application. Valid values: `SQL-1_0`, `FLINK-1_6`, `FLINK-1_8`, `FLINK-1_11`, `FLINK-1_13`, `FLINK-1_15`, `FLINK-1_18`.
* `service_execution_role` - (Required) The ARN of the [IAM role](/docs/providers/aws/r/iam_role.html) used by the application to access Kinesis data streams, Kinesis Data Firehose delivery streams, Amazon S3 objects, and other external resources.
* `application_configuration` - (Optional) The application's configuration
* `application_mode` - (Optional) The application's mode. Valid values are `STREAMING`, `INTERACTIVE`.
* `cloudwatch_logging_options` - (Optional) A [CloudWatch log stream](/docs/providers/aws/r/cloudwatch_log_stream.html) to monitor application configuration errors.
* `description` - (Optional) A summary description of the application.
* `force_stop` - (Optional) Whether to force stop an unresponsive Flink-based application.
Expand Down
Loading