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

Incorrect Terraform code sample using list of blocks #112899

Closed
dumitrux opened this issue Jul 28, 2023 · 6 comments
Closed

Incorrect Terraform code sample using list of blocks #112899

dumitrux opened this issue Jul 28, 2023 · 6 comments

Comments

@dumitrux
Copy link

Issue

There is an error in the Terraform app-service.tf code sample.
The ip_restriction and headers are lists of maps

ip_restriction = [{
  service_tag               = "AzureFrontDoor.Backend"
  ip_address                = null
  virtual_network_subnet_id = null
  action                    = "Allow"
  priority                  = 100
  headers = [{
    x_azure_fdid      = [azurerm_cdn_frontdoor_profile.my_front_door.resource_guid]
    x_fd_health_probe = []
    x_forwarded_for   = []
    x_forwarded_host  = []
  }]
  name = "Allow traffic from Front Door"
}]

Fix

As per the Terraform documentation, the ip_restriction and headerscan be one or more blocks.
Therefore, the code sample should look like this:

ip_restriction {
  service_tag               = "AzureFrontDoor.Backend"
  ip_address                = null
  virtual_network_subnet_id = null
  action                    = "Allow"
  priority                  = 100
  headers {
    x_azure_fdid      = [azurerm_cdn_frontdoor_profile.my_front_door.resource_guid]
    x_fd_health_probe = []
    x_forwarded_for   = []
    x_forwarded_host  = []
  }
  name = "Allow traffic from Front Door"
}

I have tested and the first option does not work with terraform_1.5.4 and azurerm_3.67.0, the second one works.


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

@ManoharLakkoju-MSFT
Copy link
Contributor

@dumitrux
Thanks for your feedback! We will investigate and update as appropriate.

@ChaitanyaNaykodi-MSFT
Copy link
Contributor

@dumitrux
Thank you for your feedback! We have assigned this issue to the author to review further and take the next course of action.

@johndowns
Copy link
Contributor

@dumitrux Thanks. This is a change in a recent AzureRM provider version. The example works as-is when you follow the tutorial and use version 3.27.0 of the provider.

I'll submit a version update shortly - it might take a a bit of time to get updated.

#please-close

@johndowns
Copy link
Contributor

PR: Azure/terraform#242

@johndowns
Copy link
Contributor

@dumitrux The updated PR has been merged, which means that our docs should update (I think within about 24 hours) :)

@dumitrux
Copy link
Author

dumitrux commented Aug 9, 2023

It has been updated!
Thanks for the update and quick response @johndowns and all the participants :)

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

4 participants