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

[Storage Account] dfs, web endpoints, file secondary endpoint #3110

Merged
merged 5 commits into from
Mar 29, 2019

Conversation

Lucretius
Copy link
Contributor

Resolves #3082

I also noticed that the new API version provided a way to get the secondary File endpoints, so that has been added as well.

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 @Lucretius,

Thank you for the PR, this LGTM aside from i wonder if it would be helpful to write a helper function to manage some of the repetition in the code? WDYT?

@@ -1146,5 +1225,49 @@ func flattenAndSetAzureRmStorageAccountSecondaryEndpoints(d *schema.ResourceData
d.Set("secondary_table_endpoint", tableEndpoint)
d.Set("secondary_table_host", tableHost)

var webEndpoint, webHost string
if secondary != nil {
if v := secondary.Web; v != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I wonder if it would be worthwhile to add a helper function to this file 🤔

if secondary != nil {
  webEndpoint, webHost err = parseEndPoint(secondary.Web)
  if err != nil { return err }
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I can refactor to add one in.

@Lucretius
Copy link
Contributor Author

I've added a helper function to remove most of the duplication.

@ghost ghost removed the waiting-response label Mar 25, 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.

Thanks for that change @Lucretius! looks much better now, but i believe there is a bug as the tests are failing with:

Test ended in panic.

------- Stdout: -------
=== RUN   TestAccAzureRMStorageAccount_blobConnectionString
=== PAUSE TestAccAzureRMStorageAccount_blobConnectionString
=== CONT  TestAccAzureRMStorageAccount_blobConnectionString

------- Stderr: -------
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x2138e86]

goroutine 187 [running]:
github.com/terraform-providers/terraform-provider-azurerm/azurerm.flattenAndSetAzureRmStorageAccountSecondaryEndpoints(0xc000582770, 0x0, 0x1e, 0x2660ce0)
	/opt/teamcity-agent/work/458e5e4800bd94f6/src/github.com/terraform-providers/terraform-provider-azurerm/azurerm/resource_arm_storage_account.go:1112 +0x26
github.com/terraform-providers/terraform-provider-azurerm/azurerm.resourceArmStorageAccountRead(0xc000582770, 0x29e6a40, 0xc00081ea80, 0x2, 0x2)
	/opt/teamcity-agent/work/458e5e4800bd94f6/src/github.com/terraform-providers/terraform-provider-azurerm/azurerm/resource_arm_storage_account.go:788 +0xe52
github.com/terraform-providers/terraform-provider-azurerm/azurerm.resourceArmStorageAccountCreate(0xc000582770, 0x29e6a40, 0xc00081ea80, 0xc000582770, 0x0)
	/opt/teamcity-agent/work/458e5e4800bd94f6/src/github.com/terraform-providers/terraform-provider-azurerm/azurerm/resource_arm_storage_account.go:530 +0x113c
github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/helper/schema.(*Resource).Apply(0xc0000eef50, 0xc0004f85a0, 0xc000af1020, 0x29e6a40, 0xc00081ea80, 0xc000719701, 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/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/helper/schema.(*Provider).Apply(0xc00029ed90, 0xc0000b7f90, 0xc0004f85a0, 0xc000af1020, 0x1, 0x481593, 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/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/terraform.(*EvalApply).Eval(0xc000af2ac0, 0x2f39ec0, 0xc00028dee0, 0x2, 0x2, 0x2a1f451, 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/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/terraform.EvalRaw(0x2ef9620, 0xc000af2ac0, 0x2f39ec0, 0xc00028dee0, 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/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/terraform.(*EvalSequence).Eval(0xc000af03e0, 0x2f39ec0, 0xc00028dee0, 0x2, 0x2, 0x2a1f451, 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/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/terraform.EvalRaw(0x2ef9b60, 0xc000af03e0, 0x2f39ec0, 0xc00028dee0, 0x26e2720, 0x4b54342, 0x2660ce0, 0xc00089de10)
	/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/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/terraform.Eval(0x2ef9b60, 0xc000af03e0, 0x2f39ec0, 0xc00028dee0, 0xc000af03e0, 0x2ef9b60, 0xc000af03e0, 0x2c66c00)
	/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/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/terraform.(*Graph).walk.func1(0x297afa0, 0xc0006a9710, 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/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/dag.(*Walker).walkVertex(0xc000244310, 0x297afa0, 0xc0006a9710, 0xc00055a840)
	/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/terraform-providers/terraform-provider-azurerm/vendor/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

@Lucretius
Copy link
Contributor Author

@katbyte turns out that I shouldn't pass both secondary and secondary.Blob (or any subproperty) into the function when the property itself could potentially be nil! I added nil checks to both the primary and secondary and ran the previously failing acceptance test to verify.

@ghost ghost removed the waiting-response label Mar 28, 2019
@tombuildsstuff tombuildsstuff dismissed katbyte’s stale review March 29, 2019 09:23

dismissing since changes have been pushed

@tombuildsstuff
Copy link
Contributor

Ignoring a known (existing) test failure, the tests pass:

Screenshot 2019-03-29 at 11 08 18

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.

LGTM - thanks for this @Lucretius

@tombuildsstuff tombuildsstuff merged commit fefaddc into hashicorp:master Mar 29, 2019
@tombuildsstuff tombuildsstuff added this to the v1.24.0 milestone Mar 29, 2019
tombuildsstuff added a commit that referenced this pull request Mar 29, 2019
@ghost
Copy link

ghost commented Apr 3, 2019

This has been released in version 1.24.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.24.0"
}
# ... other configuration ...

@ghost
Copy link

ghost commented Apr 28, 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 👉 [email protected]. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 28, 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.

Storage Account - Support Web and DFS endpoints
3 participants