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

d/aws_iam_server_certificate: add support for retrieving public key #2749

Merged
merged 4 commits into from
Jan 3, 2018

Conversation

trung
Copy link
Contributor

@trung trung commented Dec 22, 2017

Invoke API_GetServerCertificate to obtain additional information for server certificate. Among which, certificate_body is useful when configuring back-end instance authentication with aws_load_balancer_policy and aws_load_balancer_backend_server_policy

Also fix the date format to be RFC-compliant

For #2742

Copy link
Contributor

@Ninir Ninir left a comment

Choose a reason for hiding this comment

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

Hi @trung

This looks very good, thanks for the work!

$ make testacc TEST=./aws TESTARGS='-run=TestAccAWSDataSourceIAMServerCertificate_'     

==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -run=TestAccAWSDataSourceIAMServerCertificate_ -timeout 120m
=== RUN   TestAccAWSDataSourceIAMServerCertificate_basic
--- PASS: TestAccAWSDataSourceIAMServerCertificate_basic (27.59s)
=== RUN   TestAccAWSDataSourceIAMServerCertificate_matchNamePrefix
--- PASS: TestAccAWSDataSourceIAMServerCertificate_matchNamePrefix (3.95s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws-clone/aws	31.594s

Just left a nitpick to address before merging, ensuring every new attribute is well set. 🚀

@@ -57,6 +57,7 @@ func TestAccAWSDataSourceIAMServerCertificate_basic(t *testing.T) {
resource.TestCheckResourceAttrSet("data.aws_iam_server_certificate.test", "id"),
resource.TestCheckResourceAttrSet("data.aws_iam_server_certificate.test", "name"),
resource.TestCheckResourceAttrSet("data.aws_iam_server_certificate.test", "path"),
resource.TestMatchResourceAttr("data.aws_iam_server_certificate.test", "certificate_body", regexp.MustCompile("^-----BEGIN CERTIFICATE-----")),
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you also add the check for upload_date & certificate_chain?

@@ -10,6 +10,7 @@ import (
"github.com/aws/aws-sdk-go/service/iam"
"github.com/hashicorp/errwrap"
"github.com/hashicorp/terraform/helper/schema"
"time"
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick: can you also move that line 8 also? 😄

@Ninir Ninir added waiting-response Maintainers are waiting on response from community or contributor. enhancement Requests to existing resources that expand the functionality or scope. labels Dec 22, 2017
@trung
Copy link
Contributor Author

trung commented Dec 22, 2017

thanks @Ninir, refactored per your comments and reran the tests

❯ make testacc TESTARGS="-run=TestAccAWSDataSourceIAMServerCertificate_*"
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test $(go list ./... |grep -v 'vendor') -v -run=TestAccAWSDataSourceIAMServerCertificate_* -timeout 120m
?   	github.com/terraform-providers/terraform-provider-aws	[no test files]
=== RUN   TestAccAWSDataSourceIAMServerCertificate_basic
--- PASS: TestAccAWSDataSourceIAMServerCertificate_basic (24.62s)
=== RUN   TestAccAWSDataSourceIAMServerCertificate_matchNamePrefix
--- PASS: TestAccAWSDataSourceIAMServerCertificate_matchNamePrefix (3.16s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	27.814s

@trung
Copy link
Contributor Author

trung commented Dec 22, 2017

❯ make testacc TESTARGS="-run=TestAccAWSDataSourceIAMServerCertificate_*"
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test $(go list ./... |grep -v 'vendor') -v -run=TestAccAWSDataSourceIAMServerCertificate_* -timeout 120m
?   	github.com/terraform-providers/terraform-provider-aws	[no test files]
=== RUN   TestAccAWSDataSourceIAMServerCertificate_basic
--- PASS: TestAccAWSDataSourceIAMServerCertificate_basic (15.06s)
=== RUN   TestAccAWSDataSourceIAMServerCertificate_matchNamePrefix
--- PASS: TestAccAWSDataSourceIAMServerCertificate_matchNamePrefix (1.72s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	16.821s

@Ninir
Copy link
Contributor

Ninir commented Jan 3, 2018

Hey @trung

Looks good to me! Thanks for the work! :) 🚀

$ make testacc TEST=./aws TESTARGS='-run=TestAccAWSDataSourceIAMServerCertificate_'

==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -run=TestAccAWSDataSourceIAMServerCertificate_ -timeout 120m
=== RUN   TestAccAWSDataSourceIAMServerCertificate_basic
--- PASS: TestAccAWSDataSourceIAMServerCertificate_basic (26.35s)
=== RUN   TestAccAWSDataSourceIAMServerCertificate_matchNamePrefix
--- PASS: TestAccAWSDataSourceIAMServerCertificate_matchNamePrefix (3.83s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws-clone/aws	30.221s

@bflad
Copy link
Contributor

bflad commented Jan 12, 2018

This has been released in terraform-provider-aws version 1.7.0. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

@bflad bflad added this to the v1.7.0 milestone Jan 12, 2018
@ghost
Copy link

ghost commented Apr 8, 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 8, 2020
@breathingdust breathingdust removed the waiting-response Maintainers are waiting on response from community or contributor. label Sep 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants