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

[pull] main from hashicorp:main #188

Open
wants to merge 180 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
180 commits
Select commit Hold shift + click to select a range
f089257
FourPointOh - remove for most resources between d-r services (#28006)
katbyte Nov 14, 2024
93df4d9
`azurerm_mssql_database`/`azurerm_mssql_managed_database` - remove Co…
neil-yechenwei Nov 14, 2024
2f57f14
New resource: `azurerm_netapp_backup_vault` and `azurerm_netapp_backu…
paulomarquesc Nov 15, 2024
9dee117
Update CHANGELOG.md for #27188
mbfrahry Nov 15, 2024
504be4d
New Data Source: `azurerm_key_vault_managed_hardware_security_module_…
wuxu92 Nov 15, 2024
114b4e3
Update CHANGELOG.md #27827
katbyte Nov 15, 2024
0d268dd
Add .NET 9 support for app service and functions (#27880)
JoshWoodArup Nov 15, 2024
a6fb1bb
Update CHANGELOG.md #27879
katbyte Nov 15, 2024
7d5c077
v4.10.0
katbyte Nov 15, 2024
3c0a43d
`azurerm_container_registry_token_password` - Handle gone container r…
magodo Nov 15, 2024
23d08f8
Update for #27232
stephybun Nov 15, 2024
873c388
`azurerm_security_center_storage_defender` - fix acctests (#28031)
ziyeqf Nov 15, 2024
020ae9a
`azurerm_iot_security_solution` - update test cases (#28026)
ziyeqf Nov 15, 2024
852fb9a
Added 'Informatica.DataManagement/organizations' to allowed service n…
CorrenSoft Nov 15, 2024
c4eacea
Update for #27993
stephybun Nov 15, 2024
f684348
Upgrade batch API version to 2024-07-01 (#27982)
liuwuliuyun Nov 15, 2024
4e90d53
Update for #27982
stephybun Nov 15, 2024
6e8c18e
azurerm_api_management_api_diagnostic & azurerm_api_management_diagno…
katbyte Nov 16, 2024
bb71b88
Update CHANGELOG.md #27630
katbyte Nov 16, 2024
f9a191c
FourPointOh - remove from services A-I with low find counts (#28021)
katbyte Nov 16, 2024
cac13c0
Migrating Azure Sentinel to new Kermit endpoint (#28041)
Chambras Nov 18, 2024
8562726
`azurerm_security_center_auto_provisioning` - deprecate resource (#28…
ziyeqf Nov 18, 2024
2c96231
`azurerm_logic_app_standard` - fix acctest (#28029)
ziyeqf Nov 18, 2024
306b5d3
`acctest` - restore test provider definition for alt tenant testing (…
jackofallops Nov 18, 2024
5286f48
FourPointOh - Remove from services storage, containers, cdn, misc (#2…
katbyte Nov 19, 2024
7ffbec8
[COMPLIANCE] Add Copyright and License Headers (#28056)
hashicorp-copywrite[bot] Nov 19, 2024
138875f
Update test error when trying to update a ForceNew property (#28057)
mbfrahry Nov 19, 2024
b209843
Azure Container Registry: Update API to 2023-11-01-preview (#27983)
magodo Nov 19, 2024
dc11224
Update for #27983
stephybun Nov 19, 2024
060fd28
azurerm_web_application_firewall_policy: Adding 1.1 value as allowed …
CorrenSoft Nov 19, 2024
54f314f
Update for #28039
stephybun Nov 19, 2024
04d4eed
`azurerm_arc_machine` - support `identity` and `tags` properties (#27…
teowa Nov 19, 2024
c29f875
Update for #27987
stephybun Nov 19, 2024
17cf4d7
`nginx`: fix nginx configuration acc test (#27734)
wuxu92 Nov 19, 2024
780ebd8
New Resource: `azurerm_eventgrid_namespace` (#27682)
catriona-m Nov 19, 2024
a6a3053
Update CHANGELOG.md #27682
catriona-m Nov 19, 2024
eb4c9d3
Update CODEOWNERS (#28071)
katbyte Nov 19, 2024
778ff9e
`azurerm_cosmosdb_account` - update for TLS 1.0&1.1 retirement (#27986)
ziyeqf Nov 20, 2024
ebaaa05
`azurerm_eventhub_namespace` - `minimum_tls_version` no longer accept…
ziyeqf Nov 20, 2024
74c745b
Dependencies - update go-azure-sdk to v0.20241118.1115603 (#28075)
neil-yechenwei Nov 21, 2024
778c935
Update schema-design-considerations.md (#27954)
katbyte Nov 21, 2024
0b71a09
Update kusto_cluster_resource.go (#27529)
hqhqhqhqhqhqhqhqhqhqhq Nov 21, 2024
28f7783
`azurerm_api_management` - remove check that `public_ip_address_id` m…
sinbai Nov 21, 2024
5ad70ac
`azurerm_virtual_network_gateway` - changing `ip_configuration` force…
ziyeqf Nov 21, 2024
56795f3
Adapt validation for azurerm_container_app.secret and fix error outpu…
nicoluca Nov 21, 2024
956bb5a
network manager support Routing for scope_accesses (#28033)
teowa Nov 21, 2024
ab63347
feat: set implicit `condition_version` on `azurerm_role_assignment` (…
logan-bobo Nov 21, 2024
7b0f662
fix app gateway check for rewrite_rule block (#28011)
teowa Nov 21, 2024
06bd17a
Update for #28011 #27189 #28033 #27935 #27828 #27976 #27529 #28075
stephybun Nov 21, 2024
34e001d
New Ephemeral Resources - `azurerm_key_vault_secret` `azurerm_key_vau…
stephybun Nov 21, 2024
ec3737e
Update for #28083
stephybun Nov 21, 2024
779f7f1
`azurerm_network_watcher_flow_log`: Property changes (#26015)
favoretti Nov 21, 2024
8fcb096
Update for #26015
stephybun Nov 21, 2024
9d15d7d
fix: create content settings for linux function app slot too (#25412)
stuartjbrown Nov 21, 2024
6c249ed
Update for #25412
stephybun Nov 21, 2024
7517f7e
`azurerm_monitor_aad_diagnostic_setting` - deprecate `enabled_log.ret…
teowa Nov 22, 2024
f03ec88
Update CHANGELOG.md tidy up multiple headings for 4.11.0
jackofallops Nov 22, 2024
7857bbe
azurerm_api_management_api fix the bug in example usage (#27758)
azarboon Nov 22, 2024
391b165
v4.11.0
jackofallops Nov 22, 2024
73e9c82
Migrating Azure Synapse to new Kermit endpoint (#28089)
Chambras Nov 22, 2024
c528c7a
Acctest: Add back the missing provider config (#28052)
magodo Nov 22, 2024
1233cea
application_insights_api_key: Fixes infinite loop while checking for …
TwinbrotherPro Nov 22, 2024
6403cb5
Update for #28037
stephybun Nov 22, 2024
3f13aa8
`azurerm_eventhub` - deprecate `namespace_name` and `resource_group_n…
catriona-m Nov 22, 2024
4a162aa
Update CHANGELOG.md #28055
catriona-m Nov 22, 2024
72efe20
`azurerm_search_service` - support attribute `customer_managed_key_en…
liuwuliuyun Nov 25, 2024
448743b
Update for #27478
stephybun Nov 25, 2024
c505f86
`azurerm_virtual_network_gateway` - fix crash issue when specifying `…
sinbai Nov 25, 2024
f6c7acb
Update CHANGELOG.md for #28099
jackofallops Nov 25, 2024
14e9354
`azurerm_logic_app_standard` - update resource to use `go-azure-sdk` …
stephybun Nov 25, 2024
eeb928f
Update for #27913
stephybun Nov 25, 2024
525ceef
note that this can be used for cmk (#28092)
catriona-m Nov 25, 2024
26790cc
[COMPLIANCE] Add Copyright and License Headers (#28107)
hashicorp-copywrite[bot] Nov 26, 2024
96826db
`azurerm_container_registry_task`: Add schema validations for `agent_…
magodo Nov 26, 2024
ffe9ec3
Update for #28098
stephybun Nov 26, 2024
1196cc9
New Data Source: azurerm_mssql_managed_database (#27026)
theonlyames Nov 26, 2024
9f6abe5
Update for #27026
stephybun Nov 26, 2024
8e01fb0
For Oracle ODB@A Resources Add annotation about ForceNew to docs (#28…
eelhomsi Nov 26, 2024
9672841
`azurerm_cosmosdb_account` - Support new capabilities `EnableNoSQLFul…
shibayan Nov 26, 2024
22a7d7e
Update CHANGELOG.md #28114
catriona-m Nov 26, 2024
1b4acd8
`azurerm_data_factory_linked_service_azure_sql_database` - send `tena…
mbfrahry Nov 27, 2024
7560cf6
Update CHANGELOG.md for #28120
mbfrahry Nov 27, 2024
aebe53f
`azurerm_eventgrid_event_subscription` - fix crash when flattening `a…
mbfrahry Nov 27, 2024
e3a58c6
Update CHANGELOG.md for #28110
mbfrahry Nov 27, 2024
e9967ed
Upgrade containerapps API version from `2023-05-01` to `2024-03-01` (…
lonegunmanb Nov 27, 2024
c5ca73a
Update for #28074
stephybun Nov 27, 2024
0b5023d
azurerm_databricks_workspace - support for enhanced security complian…
ssouthcity Nov 27, 2024
c8a5ffb
Update for #26606
stephybun Nov 27, 2024
5996ac4
dependencies - update `go-azure-sdk` to `v0.20241128.1112539` (#28137)
jackofallops Nov 28, 2024
e40f92d
Update CHANGELOG.md for #28137
jackofallops Nov 28, 2024
1b8d927
`Search` - update API version to `2024-06-01-preview` (#27803)
jan-mrm Nov 28, 2024
0ba0d14
Update CHANGELOG.md for #27803
jackofallops Nov 28, 2024
764d84d
v4.12.0
katbyte Nov 29, 2024
ce28eef
Result of tsccr-helper -log-level=info gha update .github/ (#28147)
hashicorp-tsccr[bot] Dec 2, 2024
c7481ab
`azurerm_cognitive_deployment` - support for the property `dynamic_th…
liuwuliuyun Dec 2, 2024
01a34ae
Update for #28100
stephybun Dec 2, 2024
815f252
Update nat_gateway.html.markdown (#28142)
mcle0463 Dec 2, 2024
b240052
Docs - updated `cdn_frontdoor_origin_group` docs to reflect valid hea…
bubbletroubles Dec 2, 2024
9287fe7
Update for #28143
stephybun Dec 2, 2024
a420ba8
`data.azurerm_logic_app_standard` - fix a bug on `identity` (#28158)
ziyeqf Dec 3, 2024
e98d437
[COMPLIANCE] Add Copyright and License Headers (#28154)
hashicorp-copywrite[bot] Dec 3, 2024
f7de460
`azurerm_container_group` - Fix update error with `diagnostics.log_an…
magodo Dec 3, 2024
40abc63
Update api_management_policy.html.markdown (#28151)
azarboon Dec 3, 2024
0f24868
Update api_management_backend.html.markdown (#28150)
azarboon Dec 3, 2024
ed8b0c5
`azurerm_cdn_endpoint_custom_domain` - `cdn_managed_https.tls_version…
ziyeqf Dec 3, 2024
66c6086
Update servicebus_subscription.html.markdown (#28168)
joshvito Dec 3, 2024
f536cac
[Enhance] -`azurerm_machine_learning_datastore_datalake_gen2` - Suppo…
xuzhang3 Dec 4, 2024
6ba6882
azurerm_search_service:Update basic SKU partition count from 1 to 3 (…
Gnana-Bharathi-K Dec 4, 2024
187faaa
Run ephemeral AKV tests as acceptance tests (#28184)
puneetsarna Dec 5, 2024
d10d8b5
update documentation for related azurerm_data_protection_backup_polic…
MichaelChristopherson Dec 5, 2024
4f7f6b7
`azurerm_network_watcher_flow_log`: Add 2 more resource types to `tar…
favoretti Dec 5, 2024
0a9f5c2
`azurerm_key_vault_managed_hardware_security_module_key`: add `oct-HS…
wuxu92 Dec 5, 2024
fba5bd5
lower case family name in look up (#28178)
stephybun Dec 5, 2024
1ec8819
CHANGELOG - 4.13.0 (#28159)
stephybun Dec 6, 2024
f80cef4
Update CHANGELOG.md date and links (#28192)
katbyte Dec 6, 2024
fe17c54
update the swagger link in the acctest and example (#28194)
wuxu92 Dec 6, 2024
a4a813b
`postgresql`: fix replace acctests (#27981)
wuxu92 Dec 6, 2024
779be09
`azurerm_orbital_spacecraft`, `azurerm_orbital_contact`, `azurerm_orb…
jiaweitao001 Dec 6, 2024
31cf7dc
`azurerm_search_service` allows configuration of `network_rule_bypass…
patst Dec 6, 2024
aa8b3ee
`app_service` - support preview version `21` for `java_version` (#26304)
computerlove Dec 6, 2024
fd180b3
including #28207
jonathanweinberg Dec 7, 2024
dc18cb3
Dependencies - update `go-azure-sdk` to `v0.20241206.1180327` (#28211)
WodansSon Dec 9, 2024
b167519
Doc: `azurerm_storage_container` Typo (#28214)
magodo Dec 9, 2024
8f0d6be
Update NGINXaaS API: 2024-09-01-preview (#27776)
puneetsarna Dec 9, 2024
6bab2fb
`azurerm_linux_function_app_slot`, `azurerm_windows_function_app_slot…
ziyeqf Dec 9, 2024
c661f5f
azurerm_powerbi_embedded - improve the error message for name validat…
neil-yechenwei Dec 10, 2024
a6c149f
`azurerm_logic_app_standard` - deprecate TLS below 1.2 (#28229)
ziyeqf Dec 10, 2024
a487111
azurerm_nginx - Use latest NGINXaaS API (2024-11-01-preview) (#28227)
valyria257 Dec 10, 2024
338dca6
`azurerm_mssql_server` - `minimum_tls_version` no longer accepts `Dis…
ziyeqf Dec 10, 2024
7a2f40e
New Resource : `azurerm_fabric_capacity` (#28080)
sinbai Dec 10, 2024
624763d
Contributor Docs - simplify test config names in new resource guide (…
stephybun Dec 11, 2024
26a671a
Migrating Azure SpringCloud to new Kermit endpoint (#28246)
Chambras Dec 11, 2024
4153c30
Docs: Update guide-breaking-changes.md (#28222)
sreallymatt Dec 11, 2024
a5e4f2f
`azurerm_management_group` - fix issue with child subscription dissoc…
teowa Dec 11, 2024
b1623ff
fix document (#28250)
ms-zhenhua Dec 11, 2024
357ce22
convert source_resource_ids to a set to prevent ordering issues (#27915)
stephybun Dec 11, 2024
e04e6eb
Fix bugged tests (#28257)
alexwilcox9 Dec 12, 2024
d1ad36f
`azurerm_windows_virtual_machine` - Support Hotpatch for Windows Ser…
ms-zhenhua Dec 12, 2024
941b107
New Resource: `azurerm_cognitive_rai_blocklist` (#28043)
feliperezende-barbosa Dec 12, 2024
086d9ff
Contributor Docs - Breaking Changes: update intro & clarify what cons…
katbyte Dec 13, 2024
36996bc
`CHANGELOG.md` updates for `4.14.0` release (#28197)
jackofallops Dec 13, 2024
72d455c
`azurerm_mongo_cluster` - remove the check logic for `administrator_p…
neil-yechenwei Dec 13, 2024
19b66b3
`sdk` - remove outdated information on typed resources (#28275)
stephybun Dec 13, 2024
65fd4ea
`azurerm_nginx_deployment`: Deprecate `logging_storage_account` block…
puneetsarna Dec 13, 2024
e751874
dependencies - `frontdoor` - partial update to use `2024-02-01` API (…
WodansSon Dec 13, 2024
14f86b4
`azurerm_storage_account` - fix error handling for `static_website` a…
jackofallops Dec 13, 2024
8649171
New Data Source - `azurerm_kubernetes_fleet_manager` (#28278)
sreallymatt Dec 13, 2024
ccd6377
Result of tsccr-helper -log-level=info gha update .github/ (#28290)
hashicorp-tsccr[bot] Dec 16, 2024
6eb4009
`azurerm_mongo_cluster` - move the validation to create func for `sou…
neil-yechenwei Dec 16, 2024
626f458
FourPointOh removal from 's' resources (#28300)
sreallymatt Dec 17, 2024
32b3f42
`azurerm_log_analytics_data_export_rule` - wait for state after creat…
ziyeqf Dec 17, 2024
ed20285
`azurerm_batch_pool` - support for new block `security_profile` (#28069)
liuwuliuyun Dec 17, 2024
07756a8
`azurerm_automation_software_update_configuration` remove deprecated …
wyattfry Dec 17, 2024
49ff694
Docs: azurerm_mysql_flexible_server_active_directory_administrator - …
neil-yechenwei Dec 18, 2024
7013de9
[COMPLIANCE] Add Copyright and License Headers (#28299)
hashicorp-copywrite[bot] Dec 18, 2024
60962c7
Update import spec for azurerm_cognitive_account_rai_blocklist (#28282)
magodo Dec 18, 2024
4913b97
Update api_management_api_policy.html.markdown (#28286)
azarboon Dec 18, 2024
7743928
`azurerm_network_packet_capture` - deprecate resource for 5.0 (#28324)
sreallymatt Dec 18, 2024
4a6054e
`linux_function_app` explained capabilities and added guidance (#28283)
azarboon Dec 18, 2024
81b0654
FourPointOh - remove from `service/apimanagement` (#28340)
sreallymatt Dec 18, 2024
28675a1
FourPointOh - remove from `service/loganalytics` (#28339)
sreallymatt Dec 18, 2024
706003d
fix update test (#28335)
catriona-m Dec 19, 2024
be72de3
fix function app docs (#28345)
catriona-m Dec 19, 2024
24062bb
move managed_hsm_key_id property doc to the correct resource (#28346)
catriona-m Dec 19, 2024
c21a300
Closes #25806 -- Change example SKU and Tier to a less expensive opti…
wyattfry Dec 19, 2024
e8d5187
[New Resource] `azurerm_machine_learning_workspace_network_outbound_r…
xuzhang3 Dec 19, 2024
021a08d
`azurerm_network_interface_application_gateway_backend_address_pool_a…
sreallymatt Dec 21, 2024
1872180
FourPointOh - remove from `service/compute` (#28348)
sreallymatt Dec 23, 2024
17f403e
FourPointOh - remove from service/hdinsight (#28349)
sreallymatt Dec 23, 2024
29cd6ec
FourPointOh - Remove from `service/network` (#28322)
sreallymatt Dec 23, 2024
04c6592
tooling - add workflow to auto assign reviewers (#28386)
katbyte Dec 26, 2024
65dc1c0
golangci - enable tenv linter and swap os.SetEnv to correct t.SetEnv …
katbyte Dec 26, 2024
cde02da
provider: update changelog via seperate script and update release scr…
katbyte Dec 26, 2024
5480e67
update auto assign workflow (#28387)
katbyte Dec 26, 2024
3f4b385
`azurerm_cognitive_deployment` - Update the description of the `tier`…
liuwuliuyun Dec 26, 2024
e6df919
`azurerm_monitor_data_collection_rule` - doc: remove deprecated strea…
teowa Dec 26, 2024
2129b95
Test: Add `features {}` to the provider block (#28370)
magodo Dec 26, 2024
1eb1d0c
tooling - update reviewer assign to only do it when changes are reque…
katbyte Dec 26, 2024
c912875
`azurerm_(windows|linux)_virtual_machine` - adding `os_disk` ID attri…
sreallymatt Dec 27, 2024
263badf
`azurerm_netapp_volume` - `network_features` is Optional/Computed (#…
paulomarquesc Dec 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
dependencies - frontdoor - partial update to use 2024-02-01 API (h…
…ashicorp#28233)

* Initial Check-in...

* Fix lint errors...

* Address PR comments...

* Include 2024-09-01/rules API for SslProtocol type definition...

* Add webapplicationfirewallpolicies import to security policy resource...

* Remove resource id for deprecated resource...

* Address latest PR comments...
WodansSon authored Dec 13, 2024
commit e751874419ab9e464fb87935efb7b9fcd159cb23
4 changes: 3 additions & 1 deletion internal/clients/client.go
Original file line number Diff line number Diff line change
@@ -355,7 +355,9 @@ func (client *Client) Build(ctx context.Context, o *common.ClientOptions) error
if client.Bot, err = bot.NewClient(o); err != nil {
return fmt.Errorf("building clients for Bot: %+v", err)
}
client.Cdn = cdn.NewClient(o)
if client.Cdn, err = cdn.NewClient(o); err != nil {
return fmt.Errorf("building clients for Cdn: %+v", err)
}
if client.CodeSigning, err = codesigning.NewClient(o); err != nil {
return fmt.Errorf("building clients for Code Signing: %+v", err)
}
14 changes: 8 additions & 6 deletions internal/services/cdn/cdn_frontdoor_custom_domain_resource.go
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@ import (
"time"

"github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn" // nolint: staticcheck
"github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles"
dnsValidate "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones"
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
@@ -120,9 +121,10 @@ func resourceCdnFrontDoorCustomDomain() *pluginsdk.Resource {

if !features.FivePointOhBeta() {
resource.Schema["tls"].Elem.(*pluginsdk.Resource).Schema["minimum_tls_version"] = &pluginsdk.Schema{
Type: pluginsdk.TypeString,
Optional: true,
Default: string(cdn.AfdMinimumTLSVersionTLS12),
Type: pluginsdk.TypeString,
Optional: true,
Default: string(cdn.AfdMinimumTLSVersionTLS12),
Deprecated: "As of March 1, 2025, support for 'TLS10' will be retired from Azure Front Door, therefore the 'TLS10' property value will be removed in v5.0 of the provider.",
ValidateFunc: validation.StringInSlice([]string{
string(cdn.AfdMinimumTLSVersionTLS12),
string(cdn.AfdMinimumTLSVersionTLS10),
@@ -138,12 +140,12 @@ func resourceCdnFrontDoorCustomDomainCreate(d *pluginsdk.ResourceData, meta inte
ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d)
defer cancel()

profileId, err := parse.FrontDoorProfileID(d.Get("cdn_frontdoor_profile_id").(string))
profileId, err := profiles.ParseProfileID(d.Get("cdn_frontdoor_profile_id").(string))
if err != nil {
return err
}

id := parse.NewFrontDoorCustomDomainID(profileId.SubscriptionId, profileId.ResourceGroup, profileId.ProfileName, d.Get("name").(string))
id := parse.NewFrontDoorCustomDomainID(profileId.SubscriptionId, profileId.ResourceGroupName, profileId.ProfileName, d.Get("name").(string))

existing, err := client.Get(ctx, id.ResourceGroup, id.ProfileName, id.CustomDomainName)
if err != nil {
@@ -211,7 +213,7 @@ func resourceCdnFrontDoorCustomDomainRead(d *pluginsdk.ResourceData, meta interf
}

d.Set("name", id.CustomDomainName)
d.Set("cdn_frontdoor_profile_id", parse.NewFrontDoorProfileID(id.SubscriptionId, id.ResourceGroup, id.ProfileName).ID())
d.Set("cdn_frontdoor_profile_id", profiles.NewProfileID(id.SubscriptionId, id.ResourceGroup, id.ProfileName).ID())

if props := resp.AFDDomainProperties; props != nil {
d.Set("host_name", props.HostName)
49 changes: 26 additions & 23 deletions internal/services/cdn/cdn_frontdoor_firewall_policy_data_source.go
Original file line number Diff line number Diff line change
@@ -7,14 +7,14 @@ import (
"fmt"
"time"

"github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor" // nolint: staticcheck
"github.com/hashicorp/go-azure-helpers/lang/pointer"
"github.com/hashicorp/go-azure-helpers/lang/response"
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema"
waf "github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/parse"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
"github.com/hashicorp/terraform-provider-azurerm/internal/timeouts"
"github.com/hashicorp/terraform-provider-azurerm/utils"
)

func dataSourceCdnFrontDoorFirewallPolicy() *pluginsdk.Resource {
@@ -66,41 +66,44 @@ func dataSourceCdnFrontDoorFirewallPolicy() *pluginsdk.Resource {
}

func dataSourceCdnFrontDoorFirewallPolicyRead(d *pluginsdk.ResourceData, meta interface{}) error {
client := meta.(*clients.Client).Cdn.FrontDoorLegacyFirewallPoliciesClient
client := meta.(*clients.Client).Cdn.FrontDoorFirewallPoliciesClient
subscriptionId := meta.(*clients.Client).Account.SubscriptionId
ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d)
defer cancel()

id := parse.NewFrontDoorFirewallPolicyID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string))
name := d.Get("name").(string)
resourceGroup := d.Get("resource_group_name").(string)

resp, err := client.Get(ctx, id.ResourceGroup, id.FrontDoorWebApplicationFirewallPolicyName)
id := waf.NewFrontDoorWebApplicationFirewallPolicyID(subscriptionId, resourceGroup, name)

result, err := client.PoliciesGet(ctx, id)
if err != nil {
if utils.ResponseWasNotFound(resp.Response) {
if !response.WasNotFound(result.HttpResponse) {
return fmt.Errorf("%s was not found", id)
}

return fmt.Errorf("retrieving %s: %+v", id, err)
}

skuName := ""
if sku := resp.Sku; sku != nil {
skuName = string(sku.Name)
}

d.SetId(id.ID())
d.Set("name", id.FrontDoorWebApplicationFirewallPolicyName)
d.Set("resource_group_name", id.ResourceGroup)
d.Set("sku_name", skuName)

if properties := resp.WebApplicationFirewallPolicyProperties; properties != nil {
if policy := properties.PolicySettings; policy != nil {
d.Set("enabled", policy.EnabledState == frontdoor.PolicyEnabledStateEnabled)
d.Set("mode", string(policy.Mode))
d.Set("redirect_url", policy.RedirectURL)

if model := result.Model; model != nil {
d.Set("name", id.FrontDoorWebApplicationFirewallPolicyName)
d.Set("resource_group_name", id.ResourceGroupName)
if sku := model.Sku; sku != nil {
d.Set("sku_name", string(pointer.From(sku.Name)))
}

if err := d.Set("frontend_endpoint_ids", flattenFrontendEndpointLinkSlice(properties.FrontendEndpointLinks)); err != nil {
return fmt.Errorf("flattening 'frontend_endpoint_ids': %+v", err)
if props := model.Properties; props != nil {
if err := d.Set("frontend_endpoint_ids", flattenFrontendEndpointLinkSlice(props.FrontendEndpointLinks)); err != nil {
return fmt.Errorf("flattening 'frontend_endpoint_ids': %+v", err)
}

if policy := props.PolicySettings; policy != nil {
d.Set("enabled", pointer.From(policy.EnabledState) == waf.PolicyEnabledStateEnabled)
d.Set("mode", pointer.From(policy.Mode))
d.Set("redirect_url", policy.RedirectURL)
}
}
}

Loading