Skip to content

Commit

Permalink
r/aws_emr_cluster: Keep empty strings in 'bootstrap_action.args'.
Browse files Browse the repository at this point in the history
  • Loading branch information
ewbankkit committed Jul 28, 2023
1 parent 15c61db commit 296f7e0
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 7 deletions.
2 changes: 1 addition & 1 deletion internal/service/emr/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -1740,7 +1740,7 @@ func expandBootstrapActions(bootstrapActions []interface{}) []*emr.BootstrapActi
Name: aws.String(actionName),
ScriptBootstrapAction: &emr.ScriptBootstrapActionConfig{
Path: aws.String(actionPath),
Args: flex.ExpandStringList(actionArgs),
Args: flex.ExpandStringListKeepEmpty(actionArgs),
},
}
actionsOut = append(actionsOut, action)
Expand Down
51 changes: 45 additions & 6 deletions internal/service/emr/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1040,7 +1040,18 @@ func TestAccEMRCluster_Bootstrap_ordering(t *testing.T) {
resource.TestCheckResourceAttr(resourceName, "bootstrap_action.0.args.1", "echo running on master node"),
resource.TestCheckResourceAttr(resourceName, "bootstrap_action.1.name", "test"),
resource.TestCheckResourceAttr(resourceName, "bootstrap_action.1.path", fmt.Sprintf("s3://%s/testscript.sh", rName)),
resource.TestCheckResourceAttr(resourceName, "bootstrap_action.1.args.#", "10"),
resource.TestCheckResourceAttr(resourceName, "bootstrap_action.1.args.#", "11"),
resource.TestCheckResourceAttr(resourceName, "bootstrap_action.1.args.0", ""),
resource.TestCheckResourceAttr(resourceName, "bootstrap_action.1.args.1", "1"),
resource.TestCheckResourceAttr(resourceName, "bootstrap_action.1.args.2", "2"),
resource.TestCheckResourceAttr(resourceName, "bootstrap_action.1.args.3", "3"),
resource.TestCheckResourceAttr(resourceName, "bootstrap_action.1.args.4", "4"),
resource.TestCheckResourceAttr(resourceName, "bootstrap_action.1.args.5", "5"),
resource.TestCheckResourceAttr(resourceName, "bootstrap_action.1.args.6", "6"),
resource.TestCheckResourceAttr(resourceName, "bootstrap_action.1.args.7", "7"),
resource.TestCheckResourceAttr(resourceName, "bootstrap_action.1.args.8", "8"),
resource.TestCheckResourceAttr(resourceName, "bootstrap_action.1.args.9", "9"),
resource.TestCheckResourceAttr(resourceName, "bootstrap_action.1.args.9", "10"),
),
},
{
Expand All @@ -1065,7 +1076,18 @@ func TestAccEMRCluster_Bootstrap_ordering(t *testing.T) {
resource.TestCheckResourceAttr(resourceName, "bootstrap_action.0.args.1", "echo running on master node"),
resource.TestCheckResourceAttr(resourceName, "bootstrap_action.1.name", "test"),
resource.TestCheckResourceAttr(resourceName, "bootstrap_action.1.path", fmt.Sprintf("s3://%s/testscript.sh", rName)),
resource.TestCheckResourceAttr(resourceName, "bootstrap_action.1.args.#", "10"),
resource.TestCheckResourceAttr(resourceName, "bootstrap_action.1.args.#", "11"),
resource.TestCheckResourceAttr(resourceName, "bootstrap_action.1.args.0", ""),
resource.TestCheckResourceAttr(resourceName, "bootstrap_action.1.args.1", "1"),
resource.TestCheckResourceAttr(resourceName, "bootstrap_action.1.args.2", "2"),
resource.TestCheckResourceAttr(resourceName, "bootstrap_action.1.args.3", "3"),
resource.TestCheckResourceAttr(resourceName, "bootstrap_action.1.args.4", "4"),
resource.TestCheckResourceAttr(resourceName, "bootstrap_action.1.args.5", "5"),
resource.TestCheckResourceAttr(resourceName, "bootstrap_action.1.args.6", "6"),
resource.TestCheckResourceAttr(resourceName, "bootstrap_action.1.args.7", "7"),
resource.TestCheckResourceAttr(resourceName, "bootstrap_action.1.args.8", "8"),
resource.TestCheckResourceAttr(resourceName, "bootstrap_action.1.args.9", "9"),
resource.TestCheckResourceAttr(resourceName, "bootstrap_action.1.args.9", "10"),
resource.TestCheckResourceAttr(resourceName, "bootstrap_action.2.name", "runif-2"),
resource.TestCheckResourceAttr(resourceName, "bootstrap_action.2.path", "s3://elasticmapreduce/bootstrap-actions/run-if"),
resource.TestCheckResourceAttr(resourceName, "bootstrap_action.2.args.#", "2"),
Expand Down Expand Up @@ -1095,7 +1117,18 @@ func TestAccEMRCluster_Bootstrap_ordering(t *testing.T) {
resource.TestCheckResourceAttr(resourceName, "bootstrap_action.0.args.1", "echo running on master node"),
resource.TestCheckResourceAttr(resourceName, "bootstrap_action.2.name", "test"),
resource.TestCheckResourceAttr(resourceName, "bootstrap_action.2.path", fmt.Sprintf("s3://%s/testscript.sh", rName)),
resource.TestCheckResourceAttr(resourceName, "bootstrap_action.2.args.#", "10"),
resource.TestCheckResourceAttr(resourceName, "bootstrap_action.2.args.#", "11"),
resource.TestCheckResourceAttr(resourceName, "bootstrap_action.2.args.0", ""),
resource.TestCheckResourceAttr(resourceName, "bootstrap_action.2.args.1", "1"),
resource.TestCheckResourceAttr(resourceName, "bootstrap_action.2.args.2", "2"),
resource.TestCheckResourceAttr(resourceName, "bootstrap_action.2.args.3", "3"),
resource.TestCheckResourceAttr(resourceName, "bootstrap_action.2.args.4", "4"),
resource.TestCheckResourceAttr(resourceName, "bootstrap_action.2.args.5", "5"),
resource.TestCheckResourceAttr(resourceName, "bootstrap_action.2.args.6", "6"),
resource.TestCheckResourceAttr(resourceName, "bootstrap_action.2.args.7", "7"),
resource.TestCheckResourceAttr(resourceName, "bootstrap_action.2.args.8", "8"),
resource.TestCheckResourceAttr(resourceName, "bootstrap_action.2.args.9", "9"),
resource.TestCheckResourceAttr(resourceName, "bootstrap_action.2.args.9", "10"),
resource.TestCheckResourceAttr(resourceName, "bootstrap_action.1.name", "runif-2"),
resource.TestCheckResourceAttr(resourceName, "bootstrap_action.1.path", "s3://elasticmapreduce/bootstrap-actions/run-if"),
resource.TestCheckResourceAttr(resourceName, "bootstrap_action.1.args.#", "2"),
Expand Down Expand Up @@ -3059,7 +3092,9 @@ resource "aws_emr_cluster" "test" {
path = "s3://${aws_s3_object.testobject.bucket}/${aws_s3_object.testobject.key}"
name = "test"
args = ["1",
args = [
"",
"1",
"2",
"3",
"4",
Expand Down Expand Up @@ -3123,7 +3158,9 @@ resource "aws_emr_cluster" "test" {
path = "s3://${aws_s3_object.testobject.bucket}/${aws_s3_object.testobject.key}"
name = "test"
args = ["1",
args = [
"",
"1",
"2",
"3",
"4",
Expand Down Expand Up @@ -3199,7 +3236,9 @@ resource "aws_emr_cluster" "test" {
path = "s3://${aws_s3_object.testobject.bucket}/${aws_s3_object.testobject.key}"
name = "test"
args = ["1",
args = [
"",
"1",
"2",
"3",
"4",
Expand Down

0 comments on commit 296f7e0

Please sign in to comment.