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

Add aws_redshift_scheduled_action resource #13474

Merged
merged 27 commits into from
Sep 29, 2021
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
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/13474.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:new-resource
aws_redshift_scheduled_action
```
5 changes: 5 additions & 0 deletions aws/internal/service/redshift/errors.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package redshift

const (
ErrCodeInvalidParameterValue = "InvalidParameterValue"
)
29 changes: 29 additions & 0 deletions aws/internal/service/redshift/finder/finder.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,32 @@ func ClusterByID(conn *redshift.Redshift, id string) (*redshift.Cluster, error)

return output.Clusters[0], nil
}

func ScheduledActionByName(conn *redshift.Redshift, name string) (*redshift.ScheduledAction, error) {
input := &redshift.DescribeScheduledActionsInput{
ScheduledActionName: aws.String(name),
}

output, err := conn.DescribeScheduledActions(input)

if tfawserr.ErrCodeEquals(err, redshift.ErrCodeScheduledActionNotFoundFault) {
return nil, &resource.NotFoundError{
LastError: err,
LastRequest: input,
}
}

if err != nil {
return nil, err
}

if output == nil || len(output.ScheduledActions) == 0 || output.ScheduledActions[0] == nil {
return nil, tfresource.NewEmptyResultError(input)
}

if count := len(output.ScheduledActions); count > 1 {
return nil, tfresource.NewTooManyResultsError(count, input)
}

return output.ScheduledActions[0], nil
}
1 change: 1 addition & 0 deletions aws/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -1010,6 +1010,7 @@ func Provider() *schema.Provider {
"aws_redshift_snapshot_schedule": resourceAwsRedshiftSnapshotSchedule(),
"aws_redshift_snapshot_schedule_association": resourceAwsRedshiftSnapshotScheduleAssociation(),
"aws_redshift_event_subscription": resourceAwsRedshiftEventSubscription(),
"aws_redshift_scheduled_action": resourceAwsRedshiftScheduledAction(),
"aws_resourcegroups_group": resourceAwsResourceGroupsGroup(),
"aws_route53_delegation_set": resourceAwsRoute53DelegationSet(),
"aws_route53_hosted_zone_dnssec": resourceAwsRoute53HostedZoneDnssec(),
Expand Down
1 change: 1 addition & 0 deletions aws/resource_aws_iam_role_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ func init() {
"aws_lambda_function",
"aws_launch_configuration",
"aws_redshift_cluster",
"aws_redshift_scheduled_action",
"aws_spot_fleet_request",
},
F: testSweepIamRoles,
Expand Down
Loading