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

State not being saved in Azure Storage blob container #12

Closed
matthewpyost opened this Issue Jul 25, 2018 · 10 comments

Comments

Projects
None yet
4 participants
@matthewpyost
Copy link

matthewpyost commented Jul 25, 2018

When using the version 2.* of your VSTS Task from the VSTS marketplace, after running an "apply" command the Terraform state is not being stored in the specified Azure Storages Account. Attached is a screenshot of the configuration. Version 1.* I was able to get the "apply" command to store the state in the storage account. Any help or insights on this issue would be appreciated.
vsts-task-config

@mud5150

This comment has been minimized.

Copy link
Collaborator

mud5150 commented Jul 28, 2018

Hey @matthewpyost I will try to reproduce. Can you post the build logs?

@mrommelf

This comment has been minimized.

Copy link

mrommelf commented Oct 30, 2018

I am having the same issue with version 2.* has anyone found a solution or work around?

@mud5150

This comment has been minimized.

Copy link
Collaborator

mud5150 commented Oct 31, 2018

@mrommelf Can you post your build logs? Now that I think about it I wonder if this is an issue with using the new V2 storage account. I gave that a try when it first came out and terraform didn't seem to work with that. You may need to provision an account as v1 blob storage type. Just a guess. If that's not the issue I can take a look at the logs to see if that provides some insight. I have many builds using v2 of the step with state in Azure storage.

@xtellurian

This comment has been minimized.

Copy link

xtellurian commented Nov 1, 2018

I'm seeing this problem too.
I just created a Storage V1 account, and the state is not persisted there either.

@xtellurian

This comment has been minimized.

Copy link

xtellurian commented Nov 2, 2018

Perhaps the issue might be with Terraform backend configuration.

I added this file to my terraform project, and the state file was created in Blob storage.

terraform {
  backend "azurerm" {
    storage_account_name = "tfstatenkadsnf"
    container_name       = "tfstate"
    key                  = "dev.terraform.tfstate"
  }
}

Then I override the key when I initialise Terraform in Azure DevOps

image

@mud5150

This comment has been minimized.

Copy link
Collaborator

mud5150 commented Nov 2, 2018

@xtellurian I will see if I have any problems overriding the key in the arguments field.

@mud5150

This comment has been minimized.

Copy link
Collaborator

mud5150 commented Nov 2, 2018

@xtellurian Are you specifying a resource group in the backend config? If all of the values in the storage account fields are the same as what's in your backend config you don't need to use the "Specify Storage Account" option.

@xtellurian

This comment has been minimized.

Copy link

xtellurian commented Nov 2, 2018

This does not work

terraform {
  backend "azurerm" {
    resource_group       = "tf-master"
    storage_account_name = "tfstatenkadsnf"
    container_name       = "tfstate"
    key                  = "dev.terraform.tfstate"
  }
}

image

results in
image

@mud5150

This comment has been minimized.

Copy link
Collaborator

mud5150 commented Nov 2, 2018

@xtellurian The property name in your backend config should be set to resource_group_name

@xtellurian

This comment has been minimized.

Copy link

xtellurian commented Nov 2, 2018

@mud5150 thanks - that works.

@mud5150 mud5150 closed this Dec 19, 2018

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