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

Don't store full certificate data in state file (Fixes: #156). #349

Merged
merged 1 commit into from
Dec 16, 2019

Conversation

andrewsomething
Copy link
Member

$ make testacc TESTARGS='-run=TestAccDigitalOceanCertificate_Basic'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test $(go list ./... |grep -v 'vendor') -v -run=TestAccDigitalOceanCertificate_Basic -timeout 120m
?   	github.com/terraform-providers/terraform-provider-digitalocean	[no test files]
=== RUN   TestAccDigitalOceanCertificate_Basic
--- PASS: TestAccDigitalOceanCertificate_Basic (21.16s)
PASS
ok  	github.com/terraform-providers/terraform-provider-digitalocean/digitalocean	21.181s

@ghost ghost added the size/S label Dec 13, 2019
@zachgersh
Copy link

@andrewsomething
Copy link
Member Author

@zachgersh Found the original issue and commit:

hashicorp/terraform#3837
hashicorp/terraform-provider-aws@1ed4e49

Seems like Windows style line ending were causing unintentional diffs to be generated. Using the cert material from their tests, it looks like the DO API will not even accept a cert with them.

Using this:

https://raw.githubusercontent.com/terraform-providers/terraform-provider-aws/1ed4e4933b5d8b7e66450162f638d08df8c27333/test-fixtures/iam-ssl-windows-line-endings.pem

the API fails with:

Error creating Certificate: POST https://api.digitalocean.com/v2/certificates: 422 (request "a016ee5d-9271-4376-9699-a431c0bfa218") Invalid certificate data rpc error: code = InvalidArgument desc = The provided certificate or private key is not a valid PEM block

Stripping the CRs, the resulting cert works:

cat iam-ssl-windows-line-endings.pem |  tr -d '\r' > iam-ssl-windows-line-endings-1.pem

So I'd guess that IAM Server is stripping these itself.

@andrewsomething andrewsomething merged commit 726215a into master Dec 16, 2019
@andrewsomething andrewsomething deleted the asb/issues/156 branch December 16, 2019 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants