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 certificate support for Azure Batch #3097

Merged
merged 21 commits into from
Apr 12, 2019

Conversation

stuartleeks
Copy link
Contributor

Fixes #2822

Copy link
Contributor

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

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

hey @stuartleeks

Thanks for this PR :)

I've taken a look through and left some comments inline (most of which are minor/for consistency with other resources) but this is looking pretty good - if we can fix those comments up (and the tests pass) then we should be able to get this merged 👍

Thanks!

azurerm/data_source_batch_certificate.go Outdated Show resolved Hide resolved
azurerm/data_source_batch_certificate.go Outdated Show resolved Hide resolved
azurerm/data_source_batch_certificate.go Outdated Show resolved Hide resolved
azurerm/data_source_batch_certificate.go Show resolved Hide resolved
azurerm/data_source_batch_pool_test.go Outdated Show resolved Hide resolved
website/docs/r/batch_certificate.html.markdown Outdated Show resolved Hide resolved
website/docs/r/batch_certificate.html.markdown Outdated Show resolved Hide resolved
website/docs/r/batch_pool.html.markdown Outdated Show resolved Hide resolved
website/docs/r/batch_pool.html.markdown Outdated Show resolved Hide resolved
website/docs/r/batch_pool.html.markdown Outdated Show resolved Hide resolved
@stuartleeks
Copy link
Contributor Author

@tombuildsstuff , thanks for the review!

I've pushed a few commits that address most of the feedback (have marked those conversations as resolved) and also rebased on master to keep the changes fresh. Waiting on the build to be queued currently.

There are still a couple of discussion points that I'd value your feedback on.

@ghost ghost removed the waiting-response label Mar 28, 2019
@stuartleeks
Copy link
Contributor Author

@tombuildsstuff - just checked back and see that the build/tests passed ok in CI build :-)

Let me know your thoughts on the changes/remaining questions and whether you are happy with the PR (or have further changes you would like)

Copy link
Contributor

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

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

hey @stuartleeks

Thanks for pushing those changes; I've taken a look through and left some additional (minor) comments in-line but this mostly LGTM - if we can fix those comments up we should be able to run the tests and get this merged 👍

Thanks!

azurerm/data_source_batch_pool.go Outdated Show resolved Hide resolved
azurerm/data_source_batch_pool.go Outdated Show resolved Hide resolved
azurerm/helpers/azure/batch_pool.go Outdated Show resolved Hide resolved
azurerm/helpers/azure/batch_pool.go Outdated Show resolved Hide resolved
azurerm/helpers/azure/batch_pool.go Outdated Show resolved Hide resolved
website/docs/d/batch_certificate.html.markdown Outdated Show resolved Hide resolved
website/docs/r/batch_certificate.html.markdown Outdated Show resolved Hide resolved
website/docs/r/batch_certificate.html.markdown Outdated Show resolved Hide resolved
website/docs/r/batch_certificate.html.markdown Outdated Show resolved Hide resolved
@tombuildsstuff
Copy link
Contributor

@stuartleeks I've also just noticed the file azurerm/testdata/packages-microsoft-prod.deb in this PR which I believe wants removing?

@stuartleeks
Copy link
Contributor Author

Latest changes made (with the exception of one in docs where I wasn't sure which part you were referring to).
Rebased onto current master

@ghost ghost removed the waiting-response label Apr 1, 2019
@stuartleeks
Copy link
Contributor Author

@katbyte - I just realised that some of the comments in your review were on comments in @tombuildsstuff 's review but they weren't shown by default. Just responded to them inline now. Sorry for the confusion!

Copy link
Contributor

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

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

hey @stuartleeks

Thanks for pushing those commits - this is now looking good, if we can fix up the minor remaining issues (and raise a bug in the Azure Swagger repo) this otherwise LGTM 👍

Thanks!

azurerm/data_source_batch_certificate.go Outdated Show resolved Hide resolved
azurerm/resource_arm_batch_certificate.go Show resolved Hide resolved
azurerm/resource_arm_batch_certificate.go Outdated Show resolved Hide resolved
Type: schema.TypeString,
Required: true,
ValidateFunc: validate.NoEmptyStrings,
DiffSuppressFunc: suppress.CaseDifference,
Copy link
Contributor

Choose a reason for hiding this comment

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

we should raise a bug about this API behaviour on the Rest API Specs Repository since the Resource ID should be returned in a consistent manner (whilst the ARM spec technically defines a Resource ID as case-insensitive; in practice both other ARM API's and downstream tooling don't handle these being case-insensitive - such that the casing for an ID should be the same within a Resource Provider API).

could we also add a TODO here with a link to the upstream API issue, when that's created?

@stuartleeks
Copy link
Contributor Author

@tombuildsstuff - I've made the changes you requested (including adding a comment referencing the issue created in the azure swagger repo: Azure/azure-rest-api-specs#5574)

Let me know if there's anything else needed to get this merged :-)

@ghost ghost removed the waiting-response label Apr 8, 2019
Copy link
Contributor

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

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

hey @stuartleeks

Thanks for pushing those changes - this now LGTM 👍

Thanks!

@tombuildsstuff tombuildsstuff dismissed katbyte’s stale review April 9, 2019 09:59

dismissing since changes have been pushed

katbyte
katbyte previously requested changes Apr 9, 2019
Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

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

Hi @stuartleeks,

After running the tests I believe you may have a bug in the provider:

Test ended in panic.

------- Stdout: -------
=== RUN   TestAccAzureRMBatchCertificatePfx
=== PAUSE TestAccAzureRMBatchCertificatePfx
=== CONT  TestAccAzureRMBatchCertificatePfx

------- Stderr: -------
panic: Invalid address to set: []string{"public_data"}

goroutine 257 [running]:
github.com/hashicorp/terraform/helper/schema.(*ResourceData).Set(0xc0004ac070, 0x2bf0c5b, 0xb, 0x2806880, 0xc00068c540, 0x0, 0x0)
	/opt/teamcity-agent/work/458e5e4800bd94f6/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/helper/schema/resource_data.go:191 +0x334
github.com/terraform-providers/terraform-provider-azurerm/azurerm.resourceArmBatchCertificateRead(0xc0004ac070, 0x2bb1100, 0xc000627000, 0xc0009c65a0, 0x0)
	/opt/teamcity-agent/work/458e5e4800bd94f6/src/github.com/terraform-providers/terraform-provider-azurerm/azurerm/resource_arm_batch_certificate.go:163 +0x857
github.com/terraform-providers/terraform-provider-azurerm/azurerm.resourceArmBatchCertificateCreate(0xc0004ac070, 0x2bb1100, 0xc000627000, 0xc0004ac070, 0x0)
	/opt/teamcity-agent/work/458e5e4800bd94f6/src/github.com/terraform-providers/terraform-provider-azurerm/azurerm/resource_arm_batch_certificate.go:132 +0xe42
github.com/hashicorp/terraform/helper/schema.(*Resource).Apply(0xc0004b0620, 0xc0005dd9a0, 0xc000c1b420, 0x2bb1100, 0xc000627000, 0xc0006ecb01, 0x3e, 0x0)
	/opt/teamcity-agent/work/458e5e4800bd94f6/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/helper/schema/resource.go:225 +0x351
github.com/hashicorp/terraform/helper/schema.(*Provider).Apply(0xc00036fa40, 0xc0005dd310, 0xc0005dd9a0, 0xc000c1b420, 0x1, 0x4813d3, 0x0)
	/opt/teamcity-agent/work/458e5e4800bd94f6/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/helper/schema/provider.go:283 +0x9c
github.com/hashicorp/terraform/terraform.(*EvalApply).Eval(0xc000c30980, 0x317ce00, 0xc00073cdd0, 0x2, 0x2, 0x2be6b2c, 0x4)
	/opt/teamcity-agent/work/458e5e4800bd94f6/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/terraform/eval_apply.go:57 +0x226
github.com/hashicorp/terraform/terraform.EvalRaw(0x3138d60, 0xc000c30980, 0x317ce00, 0xc00073cdd0, 0x0, 0x0, 0x0, 0x0)
	/opt/teamcity-agent/work/458e5e4800bd94f6/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/terraform/eval.go:53 +0x156
github.com/hashicorp/terraform/terraform.(*EvalSequence).Eval(0xc000c1ace0, 0x317ce00, 0xc00073cdd0, 0x2, 0x2, 0x2be6b2c, 0x4)
	/opt/teamcity-agent/work/458e5e4800bd94f6/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/terraform/eval_sequence.go:14 +0x9c
github.com/hashicorp/terraform/terraform.EvalRaw(0x31392a0, 0xc000c1ace0, 0x317ce00, 0xc00073cdd0, 0x288e9a0, 0x4b504a2, 0x2806880, 0xc0006fd730)
	/opt/teamcity-agent/work/458e5e4800bd94f6/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/terraform/eval.go:53 +0x156
github.com/hashicorp/terraform/terraform.Eval(0x31392a0, 0xc000c1ace0, 0x317ce00, 0xc00073cdd0, 0xc000c1ace0, 0x31392a0, 0xc000c1ace0, 0x2e55dc0)
	/opt/teamcity-agent/work/458e5e4800bd94f6/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/terraform/eval.go:34 +0x4d
github.com/hashicorp/terraform/terraform.(*Graph).walk.func1(0x2b3d200, 0xc00000fe20, 0x0, 0x0)
	/opt/teamcity-agent/work/458e5e4800bd94f6/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/terraform/graph.go:126 +0xc45
github.com/hashicorp/terraform/dag.(*Walker).walkVertex(0xc0008a01c0, 0x2b3d200, 0xc00000fe20, 0xc0009be940)
	/opt/teamcity-agent/work/458e5e4800bd94f6/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/dag/walk.go:387 +0x367
created by github.com/hashicorp/terraform/dag.(*Walker).Update
	/opt/teamcity-agent/work/458e5e4800bd94f6/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/dag/walk.go:310 +0x986

@stuartleeks
Copy link
Contributor Author

@katbyte - I'll take a look back over the code around that area. Did you make any changes to the tests? (I didn't see that error on my machine or in the Travis build)

@ghost ghost removed the waiting-response label Apr 9, 2019
@tombuildsstuff
Copy link
Contributor

@stuartleeks this panic's caused by an Environment Variable (TF_SCHEMA_PANIC_ON_ERROR=1) set in the Makefile and on our CI server which causes a panic if you attempt to set a field which doesn't exist in the schema (or set the wrong type); depending on how you're running the tests it's possible that may not be set.

Taking a look into this it appears the public_data field is missing from the azurerm_batch_certificate resource (but is present in the data source), which is why this is failing - as such I'm going to push a commit to add this field in and re-run the tests, I hope you don't mind!

Thanks!

@tombuildsstuff tombuildsstuff dismissed katbyte’s stale review April 10, 2019 06:49

dismissing since changes have been pushed

@stuartleeks
Copy link
Contributor Author

Great - thanks @tombuildsstuff :-)

@stuartleeks
Copy link
Contributor Author

@tombuildsstuff / @katbyte are there any other changes that you want on this before it is merged? Do you want it rebased to the latest master?

@katbyte
Copy link
Collaborator

katbyte commented Apr 12, 2019

nope! we just had some issues moving to a new subscription and increasing batch account quota so we could easily test.

Just ran them now and LGTM @stuartleeks 🙂

@katbyte katbyte merged commit 387fa9b into hashicorp:master Apr 12, 2019
katbyte added a commit that referenced this pull request Apr 12, 2019
@ghost
Copy link

ghost commented Apr 17, 2019

This has been released in version 1.25.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example:

provider "azurerm" {
	version = "~> 1.25.0"
}
# ... other configuration ...

@ghost
Copy link

ghost commented May 13, 2019

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. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!

@ghost ghost locked and limited conversation to collaborators May 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add setting for certificates on batch pool
4 participants