Skip to content

Commit

Permalink
Merge pull request #16389 from ewbankkit/f-aws_kinesisanalyticsv2_app…
Browse files Browse the repository at this point in the history
…lication-FLINK-1_11

r/aws_kinesisanalyticsv2_application: Support Apache Flink v1.11
  • Loading branch information
breathingdust authored Nov 24, 2020
2 parents 48d31d8 + 5a7f008 commit 4c3d479
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 5 deletions.
86 changes: 82 additions & 4 deletions aws/resource_aws_kinesisanalyticsv2_application_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,46 @@ func TestAccAWSKinesisAnalyticsV2Application_basicFlinkApplication(t *testing.T)
CheckDestroy: testAccCheckKinesisAnalyticsV2ApplicationDestroy,
Steps: []resource.TestStep{
{
Config: testAccKinesisAnalyticsV2ApplicationConfigBasicFlinkApplication(rName),
Config: testAccKinesisAnalyticsV2ApplicationConfigBasicFlinkApplication(rName, "FLINK-1_6"),
Check: resource.ComposeTestCheckFunc(
testAccCheckKinesisAnalyticsV2ApplicationExists(resourceName, &v),
resource.TestCheckResourceAttr(resourceName, "application_configuration.#", "1"),
resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.#", "0"),
resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_snapshot_configuration.#", "1"),
resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_snapshot_configuration.0.snapshots_enabled", "true"),
resource.TestCheckResourceAttr(resourceName, "application_configuration.0.environment_properties.#", "0"),
resource.TestCheckResourceAttr(resourceName, "application_configuration.0.flink_application_configuration.#", "1"),
resource.TestCheckResourceAttr(resourceName, "application_configuration.0.flink_application_configuration.0.checkpoint_configuration.#", "1"),
resource.TestCheckResourceAttr(resourceName, "application_configuration.0.flink_application_configuration.0.checkpoint_configuration.0.checkpointing_enabled", "true"),
resource.TestCheckResourceAttr(resourceName, "application_configuration.0.flink_application_configuration.0.checkpoint_configuration.0.checkpoint_interval", "60000"),
resource.TestCheckResourceAttr(resourceName, "application_configuration.0.flink_application_configuration.0.checkpoint_configuration.0.configuration_type", "DEFAULT"),
resource.TestCheckResourceAttr(resourceName, "application_configuration.0.flink_application_configuration.0.checkpoint_configuration.0.min_pause_between_checkpoints", "5000"),
resource.TestCheckResourceAttr(resourceName, "application_configuration.0.flink_application_configuration.0.monitoring_configuration.#", "1"),
resource.TestCheckResourceAttr(resourceName, "application_configuration.0.flink_application_configuration.0.monitoring_configuration.0.configuration_type", "DEFAULT"),
resource.TestCheckResourceAttr(resourceName, "application_configuration.0.flink_application_configuration.0.monitoring_configuration.0.log_level", "INFO"),
resource.TestCheckResourceAttr(resourceName, "application_configuration.0.flink_application_configuration.0.monitoring_configuration.0.metrics_level", "APPLICATION"),
resource.TestCheckResourceAttr(resourceName, "application_configuration.0.flink_application_configuration.0.parallelism_configuration.#", "1"),
resource.TestCheckResourceAttr(resourceName, "application_configuration.0.flink_application_configuration.0.parallelism_configuration.0.auto_scaling_enabled", "true"),
resource.TestCheckResourceAttr(resourceName, "application_configuration.0.flink_application_configuration.0.parallelism_configuration.0.configuration_type", "DEFAULT"),
resource.TestCheckResourceAttr(resourceName, "application_configuration.0.flink_application_configuration.0.parallelism_configuration.0.parallelism", "1"),
resource.TestCheckResourceAttr(resourceName, "application_configuration.0.flink_application_configuration.0.parallelism_configuration.0.parallelism_per_kpu", "1"),
resource.TestCheckResourceAttr(resourceName, "application_configuration.0.sql_application_configuration.#", "0"),
resource.TestCheckResourceAttr(resourceName, "application_configuration.0.vpc_configuration.#", "0"),
testAccCheckResourceAttrRegionalARN(resourceName, "arn", "kinesisanalytics", fmt.Sprintf("application/%s", rName)),
resource.TestCheckResourceAttr(resourceName, "cloudwatch_logging_options.#", "0"),
resource.TestCheckResourceAttrSet(resourceName, "create_timestamp"),
resource.TestCheckResourceAttr(resourceName, "description", ""),
resource.TestCheckResourceAttrSet(resourceName, "last_update_timestamp"),
resource.TestCheckResourceAttr(resourceName, "name", rName),
resource.TestCheckResourceAttr(resourceName, "runtime_environment", "FLINK-1_6"),
resource.TestCheckResourceAttrPair(resourceName, "service_execution_role", iamRoleResourceName, "arn"),
resource.TestCheckResourceAttr(resourceName, "status", "READY"),
resource.TestCheckResourceAttr(resourceName, "tags.%", "0"),
resource.TestCheckResourceAttr(resourceName, "version_id", "1"),
),
},
{
Config: testAccKinesisAnalyticsV2ApplicationConfigBasicFlinkApplication(rName, "FLINK-1_8"),
Check: resource.ComposeTestCheckFunc(
testAccCheckKinesisAnalyticsV2ApplicationExists(resourceName, &v),
resource.TestCheckResourceAttr(resourceName, "application_configuration.#", "1"),
Expand Down Expand Up @@ -130,6 +169,45 @@ func TestAccAWSKinesisAnalyticsV2Application_basicFlinkApplication(t *testing.T)
resource.TestCheckResourceAttr(resourceName, "version_id", "1"),
),
},
{
Config: testAccKinesisAnalyticsV2ApplicationConfigBasicFlinkApplication(rName, "FLINK-1_11"),
Check: resource.ComposeTestCheckFunc(
testAccCheckKinesisAnalyticsV2ApplicationExists(resourceName, &v),
resource.TestCheckResourceAttr(resourceName, "application_configuration.#", "1"),
resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.#", "0"),
resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_snapshot_configuration.#", "1"),
resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_snapshot_configuration.0.snapshots_enabled", "true"),
resource.TestCheckResourceAttr(resourceName, "application_configuration.0.environment_properties.#", "0"),
resource.TestCheckResourceAttr(resourceName, "application_configuration.0.flink_application_configuration.#", "1"),
resource.TestCheckResourceAttr(resourceName, "application_configuration.0.flink_application_configuration.0.checkpoint_configuration.#", "1"),
resource.TestCheckResourceAttr(resourceName, "application_configuration.0.flink_application_configuration.0.checkpoint_configuration.0.checkpointing_enabled", "true"),
resource.TestCheckResourceAttr(resourceName, "application_configuration.0.flink_application_configuration.0.checkpoint_configuration.0.checkpoint_interval", "60000"),
resource.TestCheckResourceAttr(resourceName, "application_configuration.0.flink_application_configuration.0.checkpoint_configuration.0.configuration_type", "DEFAULT"),
resource.TestCheckResourceAttr(resourceName, "application_configuration.0.flink_application_configuration.0.checkpoint_configuration.0.min_pause_between_checkpoints", "5000"),
resource.TestCheckResourceAttr(resourceName, "application_configuration.0.flink_application_configuration.0.monitoring_configuration.#", "1"),
resource.TestCheckResourceAttr(resourceName, "application_configuration.0.flink_application_configuration.0.monitoring_configuration.0.configuration_type", "DEFAULT"),
resource.TestCheckResourceAttr(resourceName, "application_configuration.0.flink_application_configuration.0.monitoring_configuration.0.log_level", "INFO"),
resource.TestCheckResourceAttr(resourceName, "application_configuration.0.flink_application_configuration.0.monitoring_configuration.0.metrics_level", "APPLICATION"),
resource.TestCheckResourceAttr(resourceName, "application_configuration.0.flink_application_configuration.0.parallelism_configuration.#", "1"),
resource.TestCheckResourceAttr(resourceName, "application_configuration.0.flink_application_configuration.0.parallelism_configuration.0.auto_scaling_enabled", "true"),
resource.TestCheckResourceAttr(resourceName, "application_configuration.0.flink_application_configuration.0.parallelism_configuration.0.configuration_type", "DEFAULT"),
resource.TestCheckResourceAttr(resourceName, "application_configuration.0.flink_application_configuration.0.parallelism_configuration.0.parallelism", "1"),
resource.TestCheckResourceAttr(resourceName, "application_configuration.0.flink_application_configuration.0.parallelism_configuration.0.parallelism_per_kpu", "1"),
resource.TestCheckResourceAttr(resourceName, "application_configuration.0.sql_application_configuration.#", "0"),
resource.TestCheckResourceAttr(resourceName, "application_configuration.0.vpc_configuration.#", "0"),
testAccCheckResourceAttrRegionalARN(resourceName, "arn", "kinesisanalytics", fmt.Sprintf("application/%s", rName)),
resource.TestCheckResourceAttr(resourceName, "cloudwatch_logging_options.#", "0"),
resource.TestCheckResourceAttrSet(resourceName, "create_timestamp"),
resource.TestCheckResourceAttr(resourceName, "description", ""),
resource.TestCheckResourceAttrSet(resourceName, "last_update_timestamp"),
resource.TestCheckResourceAttr(resourceName, "name", rName),
resource.TestCheckResourceAttr(resourceName, "runtime_environment", "FLINK-1_11"),
resource.TestCheckResourceAttrPair(resourceName, "service_execution_role", iamRoleResourceName, "arn"),
resource.TestCheckResourceAttr(resourceName, "status", "READY"),
resource.TestCheckResourceAttr(resourceName, "tags.%", "0"),
resource.TestCheckResourceAttr(resourceName, "version_id", "1"),
),
},
{
ResourceName: resourceName,
ImportState: true,
Expand Down Expand Up @@ -2825,16 +2903,16 @@ resource "aws_security_group" "test" {
`, rName))
}

func testAccKinesisAnalyticsV2ApplicationConfigBasicFlinkApplication(rName string) string {
func testAccKinesisAnalyticsV2ApplicationConfigBasicFlinkApplication(rName, runtimeEnvironment string) string {
return composeConfig(
testAccKinesisAnalyticsV2ApplicationConfigBaseServiceExecutionIamRole(rName),
fmt.Sprintf(`
resource "aws_kinesisanalyticsv2_application" "test" {
name = %[1]q
runtime_environment = "FLINK-1_8"
runtime_environment = %[2]q
service_execution_role = aws_iam_role.test[0].arn
}
`, rName))
`, rName, runtimeEnvironment))
}

func testAccKinesisAnalyticsV2ApplicationConfigBasicSQLApplication(rName string) string {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ resource "aws_kinesisanalyticsv2_application" "example" {
The following arguments are supported:

* `name` - (Required) The name of the application.
* `runtime_environment` - (Required) The runtime environment for the application. Valid values: `SQL-1_0`, `FLINK-1_6`, `FLINK-1_8`.
* `runtime_environment` - (Required) The runtime environment for the application. Valid values: `SQL-1_0`, `FLINK-1_6`, `FLINK-1_8`, `FLINK-1_11`.
* `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
* `cloudwatch_logging_options` - (Optional) A [CloudWatch log stream](/docs/providers/aws/r/cloudwatch_log_stream.html) to monitor application configuration errors.
Expand Down

0 comments on commit 4c3d479

Please sign in to comment.