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

azurerm_static_website can't update tags if already attached to a repository #11986

Open
timja opened this issue May 27, 2021 · 2 comments
Open

Comments

@timja
Copy link
Contributor

timja commented May 27, 2021

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 "+1" or "me too" comments, 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

Terraform (and AzureRM Provider) Version

Affected Resource(s)

  • azurerm_static_site

Terraform Configuration Files

resource "azurerm_static_site" "static_webapp" {
  for_each = { for frontend in var.shutter_apps : frontend.name => frontend if !contains([
    "something",
    "something1"], frontend.name)
  }

  name                = each.value.name
  resource_group_name = data.azurerm_resource_group.shutter.name
  location            = "westeurope"
  tags                = var.common_tags
}

Debug Output

Panic Output

Expected Behaviour

Tags were applied

Actual Behaviour

│ Error: failed creating Static Site: (Name "********" / Resource Group "shutter-app-sbox-rg"): web.StaticSitesClient#CreateOrUpdateStaticSite: Failure sending request: StatusCode=0 -- Original Error: Code="BadRequest" Message="RepositoryUrl is invalid.  Cannot change the RepositoryUrl. Please detach your static site first if you wish to attach to another repository." Details=[{"Message":"RepositoryUrl is invalid.  Cannot change the RepositoryUrl. Please detach your static site first if you wish to attach to another repository."},{"Code":"BadRequest"},{"ErrorEntity":{"Code":"BadRequest","ExtendedCode":"51021","Message":"RepositoryUrl is invalid.  Cannot change the RepositoryUrl. Please detach your static site first if you wish to attach to another repository.","MessageTemplate":"{0} is invalid.  {1}","Parameters":["RepositoryUrl","Cannot change the RepositoryUrl. Please detach your static site first if you wish to attach to another repository."]}}]
│
│   with module.shutter_swa.azurerm_static_site.static_webapp["reformscan"],
│   on ../../modules/shutter_page_swa/static_webapps.tf line 5, in resource "azurerm_static_site" "static_webapp":
│    5: resource "azurerm_static_site" "static_webapp" {

Steps to Reproduce

  1. Create a static site with no tags
  2. Attach it to a repo by adding the github action and deploying content
  3. Update terraform code to include tags
  4. terraform apply

Important Factoids

References

I suspect this line is the issue https://github.com/terraform-providers/terraform-provider-azurerm/blob/1199ef3b2e169c2d807d4ad5f58b3c373ce505d4/azurerm/internal/services/web/static_site_resource.go#L113

It's expected that these are linked outside of the azurerm provider, but we need to fill these values in if we're doing an update

  • #0000
@Satak
Copy link

Satak commented Jun 24, 2021

Same problem

Error: failed creating Static Site: (Name "stapp-dem-spoke002-prod-sami" / Resource Group "rg-dem-spoke002-prod-web-app"): 

web.StaticSitesClient#CreateOrUpdateStaticSite: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: 

Service returned an error. Status=400 Code="BadRequest" Message="Provider is invalid. Cannot change the Provider. Please detach your static site first if you wish to use to another deployment provider."

Details=[{"Message":"Provider is invalid. Cannot change the Provider. Please detach your static site first if you wish to use to another deployment provider."},{"Code":"BadRequest"},{"ErrorEntity":

{"Code":"BadRequest","ExtendedCode":"51021","Message":"Provider is invalid. Cannot change the Provider. Please detach your static site first if you wish to use to another deployment provider.","MessageTemplate":"{0} is invalid. {1}","Parameters":["Provider","Cannot change the Provider. Please detach your static site first if you wish to use to another deployment provider."]}}]

with azurerm_static_site.static_web_app

on main.tf line 15, in resource "azurerm_static_site" "static_web_app":

@timja
Copy link
Contributor Author

timja commented Jun 24, 2021

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

No branches or pull requests

3 participants