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

Fix AzureRM state backend Azure CLI support #20809

Closed
wants to merge 1 commit into from
Closed

Fix AzureRM state backend Azure CLI support #20809

wants to merge 1 commit into from

Conversation

Korijn
Copy link

@Korijn Korijn commented Mar 23, 2019

I've been trying to use the azurerm state backend with Azure CLI to no avail with terraform v0.11.13.

I've documented my conclusions on a related issue in #18325 (comment)

After more investigation and some git blame commands, I've traced down the introduction of the problem to PR #19465

The PR simply toggles the feature flag for Azure CLI support, relying on the implementation of github.com/hashicorp/go-azure-helpers/authentication which has proven its worth in the azure terraform provider.

However, there is a (legacy?) dragon lurking in the code in the form of the following if-statement:

	if config.AccessKey == "" && config.SasToken == "" && config.ResourceGroupName == "" {	
		return fmt.Errorf("Either an Access Key / SAS Token or the Resource Group for the Storage Account must be specified")	
	}

This if-statement prevents usage of the Azure CLI as an authentication method, since in that case you would only provide the storage_account_name, container_name and key. That obviously does not satisfy the above condition.

I can't find any evidence that the changes in that PR were verified/tested manually, and there also aren't any automated tests that cover Azure CLI usage with the azurerm state backend.

I'm inclined to think the if-statement should simply be removed. All tests still pass after removing it.

Disclaimer: I would like to add a unit test to cover Azure CLI usage for the future, but I'm too much of a golang noob to actually be able to do it. Any help would be appreciated.

@hashicorp-cla
Copy link

hashicorp-cla commented Mar 23, 2019

CLA assistant check
All committers have signed the CLA.

@Korijn Korijn changed the title remove overly restrictive if-statement Fix AzureRM state backend Azure CLI support Mar 23, 2019
@Korijn Korijn closed this Jun 18, 2020
@Korijn
Copy link
Author

Korijn commented Jun 18, 2020

Sorry, this PR was completely misinformed. The problems I was experiencing have nothing to do with this change.

@ghost
Copy link

ghost commented Jul 19, 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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Jul 19, 2020
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.

3 participants