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 blob not uploaded on change #27498

Closed
1 task done
MateMalice opened this issue Sep 25, 2024 · 2 comments · Fixed by #27508
Closed
1 task done

Storage blob not uploaded on change #27498

MateMalice opened this issue Sep 25, 2024 · 2 comments · Fixed by #27508

Comments

@MateMalice
Copy link

MateMalice commented Sep 25, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave comments along the lines of "+1", "me too" or "any updates", they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment and review the contribution guide to help.

Terraform Version

1.9.6

AzureRM Provider Version

4.3.0

Affected Resource(s)/Data Source(s)

azurerm_storage_blob

Terraform Configuration Files

# Configure provider
provider "azurerm" {
  features {}

  subscription_id = "xxxxxxxxxx"
}

terraform {
  required_providers {
    azurerm = {
      # User version 4.3.0
      version = "4.3.0"
    }
  }
}

# Create a storage account
resource "azurerm_storage_account" "test-storage" {
  name                     = "tfbugtest430"
  resource_group_name      = "rg-digid-authservice"
  account_replication_type = "LRS"
  account_tier             = "Standard"
  location                 = "australiaeast"
}

# Add a blob container
resource "azurerm_storage_container" "test-container" {
  name                  = "bugtest-container"
  storage_account_name  = azurerm_storage_account.test-storage.name
  container_access_type = "private"
}

# Add a blob
resource "azurerm_storage_blob" "deployed_files_branding_primary" {
  name                   = "bugtest-blob.html"
  storage_account_name   = azurerm_storage_account.test-storage.name
  storage_container_name = "bugtest-container"
  type                   = "Block"
  content_type           = "text/html"
  source_content         = file("./test-file.html")
}

# test-file.html contains the following on first run:
#<!DOCTYPE html>
#<html>
#
#<head>
#    <title>Test page</title>
#</head>
#
#<body>
#    <h1>This is a test</h1>
#</body>
#
#</html>

# test-file.html contains the following on second run: 
#<!DOCTYPE html>
#<html>
#
#<head>
#    <title>Test page</title>
#</head>
#
#<body>
#    <h1>This is a test</h1>
#    <h2>This has been added after the first run.</h2>
#</body>
#
#</html>

Debug Output/Panic Output

See output here: https://raw.githubusercontent.com/MateMalice/tf-bug-reports/refs/heads/main/2024-09-25-storage-blob-upload-failed.txt

Expected Behaviour

The blob should have been updated in the container on the second run - i.e. the new contents of the blob should match the second version of "test-file.html".

Actual Behaviour

The blob is not being updated. Not only does the debug output not show a PUT or a POST call to update the blob, but the storage account shows no changes. The update timestamp of the blob is the same as the creation timestamp, so no update was made:
image

As such, the second line is not showing in the uploaded file, even though the Terraform state contains the update.

Steps to Reproduce

  1. Create configuration as per above.
  2. Run terraform apply a first time.
  3. Modify the contents of test-file.html
  4. Run terraform apply a second time

Important Factoids

No response

References

This problem has surfaced after v4.3.0 - it did not exist in v4.2.0. In version 4.3.0, changes to storage blobs ceased triggering a destroy/recreate operation, but only trigger an update operation. The problem might be related to this change: c197c2e

@rcskosir
Copy link
Contributor

Thank you for taking the time to open this issue. Please subscribe to PR #27508 for the fix.

@github-actions github-actions bot added this to the v4.4.0 milestone Sep 30, 2024
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants