Skip to content

Commit 0547beb

Browse files
authored
Merge pull request #30360 from kadrach/fix/scheduler-schedule-target-deadletterconfig-arn-required
scheduler: mark arn attribute of dead_letter_config as required
2 parents c2e6802 + efc94dd commit 0547beb

File tree

4 files changed

+13
-10
lines changed

4 files changed

+13
-10
lines changed

.changelog/30360.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:bug
2+
resource/aws_scheduler_schedule: Mark `arn` property of `dead_letter_config` as a required property
3+
```

internal/service/scheduler/flex.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ func expandECSParameters(ctx context.Context, tfMap map[string]interface{}) *typ
103103
a.LaunchType = types.LaunchType(v)
104104
}
105105

106-
if v, ok := tfMap["network_configuration"].([]interface{}); ok && len(v) > 0 {
106+
if v, ok := tfMap["network_configuration"].([]interface{}); ok && len(v) > 0 && v[0] != nil {
107107
a.NetworkConfiguration = expandNetworkConfiguration(v[0].(map[string]interface{}))
108108
}
109109

@@ -611,39 +611,39 @@ func expandTarget(ctx context.Context, tfMap map[string]interface{}) *types.Targ
611611
a.Arn = aws.String(v)
612612
}
613613

614-
if v, ok := tfMap["dead_letter_config"].([]interface{}); ok && len(v) > 0 {
614+
if v, ok := tfMap["dead_letter_config"].([]interface{}); ok && len(v) > 0 && v[0] != nil {
615615
a.DeadLetterConfig = expandDeadLetterConfig(v[0].(map[string]interface{}))
616616
}
617617

618-
if v, ok := tfMap["ecs_parameters"].([]interface{}); ok && len(v) > 0 {
618+
if v, ok := tfMap["ecs_parameters"].([]interface{}); ok && len(v) > 0 && v[0] != nil {
619619
a.EcsParameters = expandECSParameters(ctx, v[0].(map[string]interface{}))
620620
}
621621

622-
if v, ok := tfMap["eventbridge_parameters"].([]interface{}); ok && len(v) > 0 {
622+
if v, ok := tfMap["eventbridge_parameters"].([]interface{}); ok && len(v) > 0 && v[0] != nil {
623623
a.EventBridgeParameters = expandEventBridgeParameters(v[0].(map[string]interface{}))
624624
}
625625

626626
if v, ok := tfMap["input"].(string); ok && v != "" {
627627
a.Input = aws.String(v)
628628
}
629629

630-
if v, ok := tfMap["kinesis_parameters"].([]interface{}); ok && len(v) > 0 {
630+
if v, ok := tfMap["kinesis_parameters"].([]interface{}); ok && len(v) > 0 && v[0] != nil {
631631
a.KinesisParameters = expandKinesisParameters(v[0].(map[string]interface{}))
632632
}
633633

634634
if v, ok := tfMap["role_arn"].(string); ok && v != "" {
635635
a.RoleArn = aws.String(v)
636636
}
637637

638-
if v, ok := tfMap["retry_policy"].([]interface{}); ok && len(v) > 0 {
638+
if v, ok := tfMap["retry_policy"].([]interface{}); ok && len(v) > 0 && v[0] != nil {
639639
a.RetryPolicy = expandRetryPolicy(v[0].(map[string]interface{}))
640640
}
641641

642-
if v, ok := tfMap["sagemaker_pipeline_parameters"].([]interface{}); ok && len(v) > 0 {
642+
if v, ok := tfMap["sagemaker_pipeline_parameters"].([]interface{}); ok && len(v) > 0 && v[0] != nil {
643643
a.SageMakerPipelineParameters = expandSageMakerPipelineParameters(v[0].(map[string]interface{}))
644644
}
645645

646-
if v, ok := tfMap["sqs_parameters"].([]interface{}); ok && len(v) > 0 {
646+
if v, ok := tfMap["sqs_parameters"].([]interface{}); ok && len(v) > 0 && v[0] != nil {
647647
a.SqsParameters = expandSQSParameters(v[0].(map[string]interface{}))
648648
}
649649

internal/service/scheduler/schedule.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ func resourceSchedule() *schema.Resource {
151151
Schema: map[string]*schema.Schema{
152152
"arn": {
153153
Type: schema.TypeString,
154-
Optional: true,
154+
Required: true,
155155
ValidateDiagFunc: validation.ToDiagFunc(verify.ValidARN),
156156
},
157157
},

website/docs/r/scheduler_schedule.html.markdown

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ The following arguments are optional:
107107

108108
#### dead_letter_config Configuration Block
109109

110-
* `arn` - (Optional) ARN of the SQS queue specified as the destination for the dead-letter queue.
110+
* `arn` - (Required) ARN of the SQS queue specified as the destination for the dead-letter queue.
111111

112112
#### ecs_parameters Configuration Block
113113

0 commit comments

Comments
 (0)