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

vault_azure_access_credentials crashes with subscription_id specified #1387

Closed
TechyMatt opened this issue Mar 25, 2022 · 1 comment · Fixed by #1391
Closed

vault_azure_access_credentials crashes with subscription_id specified #1387

TechyMatt opened this issue Mar 25, 2022 · 1 comment · Fixed by #1391
Assignees
Milestone

Comments

@TechyMatt
Copy link
Contributor

Hi!

I have compiled the latest release of 3.4.0 locally and it is now actively validating the credentials, however when I attempt to specify a subscription_id and tenant_id, I get a crash.

Terraform Version

Terraform v1.1.7
on linux_amd64
vault 3.4.0

Affected Resource(s)

Please list the resources as a list, for example:

  • data vault_azure_access_credentials

Terraform Configuration Files

data "vault_azure_access_credentials" "creds" {
  backend = "azure"
  role    = "edu-app"
  validate_creds = true
  num_sequential_successes = 5
  num_seconds_between_tests = 20
  max_cred_validation_seconds = 1200 // 20 minutes
  subscription_id = "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxx" 
  tenant_id = "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxx" 
}

│ Error: Plugin did not respond

│ with data.vault_azure_access_credentials.creds,
│ on main.tf line 25, in data "vault_azure_access_credentials" "creds":
│ 25: data "vault_azure_access_credentials" "creds" {

│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ReadDataSource call. The plugin logs may contain more details.

Stack trace from the terraform-provider-vault plugin:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0xfd0884]

goroutine 25 [running]:
github.com/hashicorp/terraform-provider-vault/vault.azureAccessCredentialsDataSourceRead(0xc000254300, 0x1395d40, 0xc000626280, 0x1db2240, 0xc000100000)
/mnt/c/POCs/terraform-provider-vault/vault/data_source_azure_access_credentials.go:200 +0x8c4
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).read(0xc0002970a0, 0x161cc68, 0xc0009f0800, 0xc000254300, 0x1395d40, 0xc000626280, 0x0, 0x0, 0x0)
/root/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:346 +0x1ee
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).ReadDataApply(0xc0002970a0, 0x161cc68, 0xc0009f0800, 0xc000254200, 0x1395d40, 0xc000626280, 0xc000626280, 0xc000254200, 0x0, 0x0)
/root/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:569 +0xfd
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ReadDataSource(0xc000291398, 0x161cc68, 0xc0009f0800, 0xc0009fe8c0, 0x13b2c93, 0x12, 0x0)
/root/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:1133 +0x518
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ReadDataSource(0xc0001be600, 0x161cd10, 0xc0009f0800, 0xc000a208c0, 0x0, 0x0, 0x0)
/root/go/pkg/mod/github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:478 +0x2f5
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ReadDataSource_Handler(0x134c9a0, 0xc0001be600, 0x161cd10, 0xc000a11770, 0xc000a0ea80, 0x0, 0x161cd10, 0xc000a11770, 0xc000a30780, 0x16c)
/root/go/pkg/mod/github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:416 +0x214
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0001efdc0, 0x1628238, 0xc000582d80, 0xc000a32d80, 0xc000691650, 0x1d6a450, 0x0, 0x0, 0x0)
/root/go/pkg/mod/google.golang.org/[email protected]/server.go:1279 +0x52b
google.golang.org/grpc.(*Server).handleStream(0xc0001efdc0, 0x1628238, 0xc000582d80, 0xc000a32d80, 0x0)
/root/go/pkg/mod/google.golang.org/[email protected]/server.go:1608 +0xd0c
google.golang.org/grpc.(*Server).serveStreams.func1.2(0xc0002ce160, 0xc0001efdc0, 0x1628238, 0xc000582d80, 0xc000a32d80)
/root/go/pkg/mod/google.golang.org/[email protected]/server.go:923 +0xab
created by google.golang.org/grpc.(*Server).serveStreams.func1
/root/go/pkg/mod/google.golang.org/[email protected]/server.go:921 +0x1fd

Error: The terraform-provider-vault plugin crashed!

Expected Behavior

The subscription_id and tenant_id should be able to be set.

Actual Behavior

When I don't specify subscription_id and tenant_id it runs successfully.

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform plan

Important Factoids

Tagging @benashz for awareness.

References

Are there any other GitHub issues (open or closed) or Pull Requests that should be linked here? For example:

@benashz benashz self-assigned this Mar 25, 2022
@benashz
Copy link
Contributor

benashz commented Mar 25, 2022

Looks like this caused by config not being set when both subscription_id and tenant_id are overridden (introduced in #1384).

For now it is advised not to specify both of these new fields together. We will do a patch release next week to address this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment