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

New Data Source: aws_redshift_cluster #2603

Merged
merged 2 commits into from
Apr 25, 2018

Conversation

kl4w
Copy link
Contributor

@kl4w kl4w commented Dec 9, 2017

TF_ACC=1 go test ./aws -v -run=TestAccAWSDataSourceRedshiftCluster -timeout 120m                                        
=== RUN   TestAccAWSDataSourceRedshiftCluster_basic
--- PASS: TestAccAWSDataSourceRedshiftCluster_basic (911.35s)
=== RUN   TestAccAWSDataSourceRedshiftCluster_vpc
--- PASS: TestAccAWSDataSourceRedshiftCluster_vpc (1121.35s)
=== RUN   TestAccAWSDataSourceRedshiftCluster_logging
--- PASS: TestAccAWSDataSourceRedshiftCluster_logging (779.21s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	2811.937s

@kl4w kl4w changed the title Redshift data source d/aws_redshift_cluster: create new Redshift data source Dec 12, 2017
@radeksimko radeksimko added the new-data-source Introduces a new data source. label Dec 12, 2017
@radeksimko radeksimko added the service/redshift Issues and PRs that pertain to the redshift service. label Jan 17, 2018
@radeksimko radeksimko changed the title d/aws_redshift_cluster: create new Redshift data source New Data Source: aws_redshift_cluster Jan 17, 2018
Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much for this @kl4w and sorry for the delayed review. 😅 This looks great with a few minor things I'll fix on merge. 🚀

3 tests passed (all tests)
=== RUN   TestAccAWSDataSourceRedshiftCluster_logging
--- PASS: TestAccAWSDataSourceRedshiftCluster_logging (979.28s)
=== RUN   TestAccAWSDataSourceRedshiftCluster_basic
--- PASS: TestAccAWSDataSourceRedshiftCluster_basic (1114.10s)
=== RUN   TestAccAWSDataSourceRedshiftCluster_vpc
--- PASS: TestAccAWSDataSourceRedshiftCluster_vpc (1295.04s)

return fmt.Errorf("Error describing Redshift Cluster: %s, error: %#v", cluster, err)
}

rsc := *resp.Clusters[0]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To prevent panics, we should perform nil and len() checks before here. I will fix this on merge.

d.Set("automated_snapshot_retention_period", rsc.AutomatedSnapshotRetentionPeriod)
d.Set("availability_zone", rsc.AvailabilityZone)
d.Set("cluster_identifier", rsc.ClusterIdentifier)
d.Set("cluster_parameter_group_name", rsc.ClusterParameterGroups[0].ParameterGroupName)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To prevent panics, we should perform nil and len() checks before here. I will fix this on merge.

})

if err != nil {
return fmt.Errorf("Error describing Redshift Cluster: %s, error: %#v", cluster, err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use the %s (string) value of AWS SDK errors which should make the output more readable. I will fix this on merge.

return loggingErr
}

if *loggingStatus.LoggingEnabled {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To prevent panics, we should perform nil check on loggingStatus as well -- rarely the AWS API can return no error and empty objects. I will fix this on merge.

{
Config: testAccAWSDataSourceRedshiftClusterConfig(rInt),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttrSet("data.aws_redshift_cluster.test", "allow_version_upgrade"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI we can actually test the data source attribute values against the resource attribute values using resource.TestCheckResourceAttrPair(), which is a slightly better check.

Provides details about a specific redshift cluster
---

# aws\_redshift\_cluster
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR predates the removal of extraneous forward slashes. I will remove them on merge. 👍

@bflad bflad merged commit 0aec4eb into hashicorp:master Apr 25, 2018
@bflad bflad added this to the v1.16.0 milestone Apr 25, 2018
bflad added a commit that referenced this pull request Apr 25, 2018
@kl4w kl4w deleted the redshift_data_source branch April 25, 2018 05:38
@bflad
Copy link
Contributor

bflad commented Apr 25, 2018

This has been released in version 1.16.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

@ghost
Copy link

ghost commented Apr 6, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
new-data-source Introduces a new data source. service/redshift Issues and PRs that pertain to the redshift service.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants