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

New RP Palo Alto #22700

Merged
merged 74 commits into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from 70 commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
d36ebb9
Adds NGFW and Local Rule Stack resources - Some API issues and incomp…
jackofallops Jun 27, 2023
291d64d
update validations
jackofallops Jun 29, 2023
ecbd39c
remove default_mode
jackofallops Jul 3, 2023
6289ec4
rules added
jackofallops Jul 7, 2023
02f4845
add local rule stack certs
jackofallops Jul 10, 2023
e06aeeb
add update for certificate
jackofallops Jul 10, 2023
acd9d28
add fqdnlistts
jackofallops Jul 11, 2023
8414440
add prefix lists
jackofallops Jul 11, 2023
c5d91be
switch validation to cidr from str
jackofallops Jul 11, 2023
83b2348
pad out rule stack tests
jackofallops Jul 11, 2023
6706e99
needs sdk tweak for RuleStacks to Rulestacks
jackofallops Jul 11, 2023
0ae8227
add data source and local workaround for service casing bug
jackofallops Jul 12, 2023
ae95ea9
vhub testing
jackofallops Jul 13, 2023
7bcbf9e
add palo alto nva, some docs etc
jackofallops Jul 18, 2023
74f3ab9
cert resource tweaks
jackofallops Jul 18, 2023
6abbf5d
various resoruce tweaks
jackofallops Jul 18, 2023
a23cb6e
workarounds ahoy
jackofallops Jul 20, 2023
bf9c48e
split firewalls, add associations
jackofallops Jul 24, 2023
34ef666
add locking around rulestack changes for etag guardrail...
jackofallops Jul 24, 2023
b0f78a8
fix resourcenames in vnet panorama test
jackofallops Jul 24, 2023
1d595af
add missing location to test
jackofallops Jul 25, 2023
2166be9
go mod
jackofallops Jul 25, 2023
6efe9da
update category requirements
jackofallops Jul 25, 2023
dfa398b
set location on create, add more vnet tests
jackofallops Jul 25, 2023
e47fe0b
update rule complete test
jackofallops Jul 25, 2023
b3f0286
add category name validation, fixup tests
jackofallops Jul 26, 2023
d7c125b
lint and goimports
jackofallops Jul 27, 2023
3096dd0
linting
jackofallops Jul 27, 2023
216f56f
go mod vendor
jackofallops Jul 27, 2023
ba58863
update panorama tests for env var config
jackofallops Jul 27, 2023
ed83393
tflint
jackofallops Jul 27, 2023
cd47b6d
rework cert associations, add docs
jackofallops Jul 27, 2023
e308351
make rulestack one word throughout, add more docs
jackofallops Jul 27, 2023
dffaf8f
more docs, test fixes
jackofallops Jul 28, 2023
e8bf01b
egress inconsistent plan attempted fix
jackofallops Jul 28, 2023
45f20b0
switch to meta client
jackofallops Jul 28, 2023
529b969
read model checks
jackofallops Jul 28, 2023
94b748f
review feedback changes
jackofallops Jul 28, 2023
3318f58
go imports
jackofallops Jul 31, 2023
0dd59ed
terrafmt
jackofallops Jul 31, 2023
02b4619
rebase and go mod
jackofallops Jul 31, 2023
e8184b0
net appliance api version bump
jackofallops Jul 31, 2023
ac28d13
add panorama update methods
jackofallops Jul 31, 2023
35a83fc
vhub panorama tests
jackofallops Jul 31, 2023
0162ce3
template type fix
jackofallops Jul 31, 2023
d2b5fa3
typos
jackofallops Jul 31, 2023
3b7f945
test fixes after making action required
jackofallops Jul 31, 2023
4ede10b
more test fixes post review rework
jackofallops Jul 31, 2023
363c464
missed initialising the meta client
jackofallops Jul 31, 2023
e4f2845
don't poll on rs creation, only change
jackofallops Aug 1, 2023
2a7a6d6
typos and test fixes
jackofallops Aug 2, 2023
9c53ecc
set location into state on read for panorama resources
jackofallops Aug 2, 2023
73b821f
go mod
jackofallops Aug 2, 2023
3a20414
fix inconsistent plan in network_profile
jackofallops Aug 2, 2023
13f4627
test fixes, review freedback, possible fix for inconsistent plan
jackofallops Aug 3, 2023
49ddf96
egress fixes
jackofallops Aug 4, 2023
26c3875
move egress config up to template and restore read to 5m
jackofallops Aug 7, 2023
f1a5046
test fixes, update cert source, add docs, review feedback
jackofallops Aug 8, 2023
18b3092
add examples
jackofallops Aug 8, 2023
3709adb
file renames, linting and formatting
jackofallops Aug 8, 2023
3fb482e
remove comments on docs gen
jackofallops Aug 8, 2023
826b814
terrafmt
jackofallops Aug 8, 2023
cb03787
terrafmt
jackofallops Aug 8, 2023
bfe6ef2
update tests for keyvault refs
jackofallops Aug 8, 2023
454f337
Missed template config
jackofallops Aug 8, 2023
93a9a70
remove None from secservices
jackofallops Aug 9, 2023
afaba4c
update doc for rulestack te remove None on sec services.
jackofallops Aug 9, 2023
714df6b
fix rule update bug
jackofallops Aug 9, 2023
76bb258
update CI confg for supported locations
jackofallops Aug 9, 2023
f7d81f0
update docs for optional to req'd
jackofallops Aug 9, 2023
4d02d63
review feedback and bug fix in destination and source processing
jackofallops Aug 9, 2023
367496e
rename keyvault to key_vault
jackofallops Aug 9, 2023
7a11912
whitespace fix
jackofallops Aug 9, 2023
6f7b168
goimports
jackofallops Aug 9, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .teamcity/components/generated/services.kt
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ var services = mapOf(
"nginx" to "Nginx",
"notificationhub" to "Notification Hub",
"orbital" to "Orbital",
"paloalto" to "Palo Alto",
"policy" to "Policy",
"portal" to "Portal",
"postgres" to "PostgreSQL",
Expand Down
2 changes: 2 additions & 0 deletions .teamcity/components/settings.kt
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ var serviceTestConfigurationOverrides = mapOf(
// Network Regional Tire Public IP is only available in
"network" to testConfiguration(locationOverride = LocationConfiguration("westeurope", "eastus2", "westus", false)),

"paloalto" to testConfiguration(locationOverride = LocationConfiguration("westeurope", "eastus", "westus", false)),
jackofallops marked this conversation as resolved.
Show resolved Hide resolved

"policy" to testConfiguration(useAltSubscription = true),

// Private DNS Resolver is only available in certain locations
Expand Down
92 changes: 92 additions & 0 deletions examples/paloalto/ngfw-virtual-hub-panorama/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
provider "azurerm" {
features {}
}

resource "azurerm_resource_group" "example" {
name = "${var.prefix}-resources"
location = var.location
}

resource "azurerm_public_ip" "example" {
name = "${var.prefix}-public-ip"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
allocation_method = "Static"
sku = "Standard"
}

resource "azurerm_public_ip" "egress" {
name = "${var.prefix}-public-ip-egress"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
allocation_method = "Static"
sku = "Standard"
}

resource "azurerm_virtual_wan" "example" {
name = "${var.prefix}-virtual-wan"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
}

resource "azurerm_virtual_hub" "example" {
name = "${var.prefix}-virtual-hub"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
virtual_wan_id = azurerm_virtual_wan.example.id
address_prefix = "10.0.1.0/24"

tags = {
hubSaaSPreview = "true"
}
}

resource "azurerm_palo_alto_virtual_network_appliance" "example" {
name = "${var.prefix}-nva"
virtual_hub_id = azurerm_virtual_hub.example.id
}

resource "azurerm_palo_alto_next_generation_firewall_virtual_hub_panorama" "example" {
name = "${var.prefix}-ngfw-vhub"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
panorama_base64_config = var.panorama-config

network_profile {
virtual_hub_id = azurerm_virtual_hub.example.id
network_virtual_appliance_id = azurerm_palo_alto_virtual_network_appliance.example.id
public_ip_address_ids = [azurerm_public_ip.example.id]
egress_nat_ip_address_ids = [azurerm_public_ip.egress.id]
}


dns_settings {
use_azure_dns = true
}

destination_nat {
name = "${var.prefix}DNAT-1"
protocol = "TCP"
frontend_config {
public_ip_address_id = azurerm_public_ip.example.id
port = 8081
}
backend_config {
public_ip_address = "10.0.1.101"
port = 18081
}
}

destination_nat {
name = "${var.prefix}DNAT-2"
protocol = "UDP"
frontend_config {
public_ip_address_id = azurerm_public_ip.example.id
port = 8082
}
backend_config {
public_ip_address = "10.0.1.102"
port = 18082
}
}
}
11 changes: 11 additions & 0 deletions examples/paloalto/ngfw-virtual-hub-panorama/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
variable "prefix" {
description = "The prefix which should be used for all resources in this example"
}

variable "location" {
description = "The Azure Region in which all resources in this example should be created."
}

variable "panorama-config" {
description = "The Panorama supplied, Base64 Encoded Registration Configuration"
}
158 changes: 158 additions & 0 deletions examples/paloalto/ngfw-virtual-network-rulestack/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
provider "azurerm" {
features {}
}

resource "azurerm_resource_group" "example" {
name = "${var.prefix}-resources"
location = var.location
}

resource "azurerm_public_ip" "example" {
name = "${var.prefix}-public-ip"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
allocation_method = "Static"
sku = "Standard"
}

resource "azurerm_public_ip" "egress" {
name = "${var.prefix}-public-ip-egress"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
allocation_method = "Static"
sku = "Standard"
}

resource "azurerm_network_security_group" "example" {
name = "${var.prefix}SecurityGroup1"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
}

resource "azurerm_virtual_network" "example" {
name = "${var.prefix}-virtual-network"
address_space = ["10.0.0.0/16"]
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name

tags = {
environment = "ManualTest"
}
}

resource "azurerm_subnet" "trust" {
name = "${var.prefix}-trust-subnet"
resource_group_name = azurerm_resource_group.example.name
virtual_network_name = azurerm_virtual_network.example.name
address_prefixes = ["10.0.1.0/24"]

delegation {
name = "trusted"

service_delegation {
name = "PaloAltoNetworks.Cloudngfw/firewalls"
actions = [
"Microsoft.Network/virtualNetworks/subnets/join/action",
]
}
}
}

resource "azurerm_subnet_network_security_group_association" "trust" {
subnet_id = azurerm_subnet.trust.id
network_security_group_id = azurerm_network_security_group.example.id
}

resource "azurerm_subnet" "untrust" {
name = "${var.prefix}-untrust-subnet"
resource_group_name = azurerm_resource_group.example.name
virtual_network_name = azurerm_virtual_network.example.name
address_prefixes = ["10.0.2.0/24"]

delegation {
name = "untrusted"

service_delegation {
name = "PaloAltoNetworks.Cloudngfw/firewalls"
actions = [
"Microsoft.Network/virtualNetworks/subnets/join/action",
]
}
}
}

resource "azurerm_subnet_network_security_group_association" "untrust" {
subnet_id = azurerm_subnet.untrust.id
network_security_group_id = azurerm_network_security_group.example.id
}

resource "azurerm_palo_alto_local_rulestack" "example" {
name = "${var.prefix}-rulestack"
resource_group_name = azurerm_resource_group.example.name
location = "westeurope"
}

resource "azurerm_palo_alto_local_rulestack_rule" "example" {
name = "${var.prefix}-rulestack-rule"
rulestack_id = azurerm_palo_alto_local_rulestack.example.id
priority = 9999
action = "DenySilent"

applications = ["any"]

destination {
cidrs = ["any"]
}

source {
cidrs = ["any"]
}
}

resource "azurerm_palo_alto_next_generation_firewall_virtual_network_local_rulestack" "example" {
name = "${var.prefix}-ngfw-vnet-lrs"
resource_group_name = azurerm_resource_group.example.name
rulestack_id = azurerm_palo_alto_local_rulestack.example.id

network_profile {
public_ip_address_ids = [azurerm_public_ip.example.id]
egress_nat_ip_address_ids = [azurerm_public_ip.egress.id]

vnet_configuration {
virtual_network_id = azurerm_virtual_network.example.id
trusted_subnet_id = azurerm_subnet.trust.id
untrusted_subnet_id = azurerm_subnet.untrust.id
}
}


dns_settings {
use_azure_dns = true
}

destination_nat {
name = "${var.prefix}DNAT-1"
protocol = "TCP"
frontend_config {
public_ip_address_id = azurerm_public_ip.example.id
port = 8081
}
backend_config {
public_ip_address = "10.0.1.101"
port = 18081
}
}

destination_nat {
name = "${var.prefix}DNAT-2"
protocol = "UDP"
frontend_config {
public_ip_address_id = azurerm_public_ip.example.id
port = 8082
}
backend_config {
public_ip_address = "10.0.1.102"
port = 18082
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
variable "prefix" {
description = "The prefix which should be used for all resources in this example"
}

variable "location" {
description = "The Azure Region in which all resources in this example should be created."
}
5 changes: 5 additions & 0 deletions internal/clients/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ import (
nginx "github.com/hashicorp/terraform-provider-azurerm/internal/services/nginx/client"
notificationhub "github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/client"
orbital "github.com/hashicorp/terraform-provider-azurerm/internal/services/orbital/client"
paloalto "github.com/hashicorp/terraform-provider-azurerm/internal/services/paloalto/client"
policy "github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/client"
portal "github.com/hashicorp/terraform-provider-azurerm/internal/services/portal/client"
postgres "github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/client"
Expand Down Expand Up @@ -240,6 +241,7 @@ type Client struct {
Nginx *nginx2.Client
NotificationHubs *notificationhub.Client
Orbital *orbital.Client
PaloAlto *paloalto.Client
Policy *policy.Client
Portal *portal.Client
Postgres *postgres.Client
Expand Down Expand Up @@ -512,6 +514,9 @@ func (client *Client) Build(ctx context.Context, o *common.ClientOptions) error
if client.Policy, err = policy.NewClient(o); err != nil {
return fmt.Errorf("building clients for Policy: %+v", err)
}
if client.PaloAlto, err = paloalto.NewClient(o); err != nil {
return fmt.Errorf("building clients for PaloAlto: %+v", err)
}
if client.Portal, err = portal.NewClient(o); err != nil {
return fmt.Errorf("building clients for Portal: %+v", err)
}
Expand Down
2 changes: 2 additions & 0 deletions internal/provider/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ import (
"github.com/hashicorp/terraform-provider-azurerm/internal/services/nginx"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/orbital"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/paloalto"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/policy"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/portal"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres"
Expand Down Expand Up @@ -180,6 +181,7 @@ func SupportedTypedServices() []sdk.TypedServiceRegistration {
networkfunction.Registration{},
newrelic.Registration{},
nginx.Registration{},
paloalto.Registration{},
policy.Registration{},
privatednsresolver.Registration{},
recoveryservices.Registration{},
Expand Down
26 changes: 26 additions & 0 deletions internal/services/paloalto/client/client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package client

import (
"fmt"

paloalto_2022_08_29 "github.com/hashicorp/go-azure-sdk/resource-manager/paloaltonetworks/2022-08-29"
"github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager"
"github.com/hashicorp/terraform-provider-azurerm/internal/common"
)

type Client struct {
*paloalto_2022_08_29.Client
}

func NewClient(o *common.ClientOptions) (*Client, error) {
client, err := paloalto_2022_08_29.NewClientWithBaseURI(o.Environment.ResourceManager, func(c *resourcemanager.Client) {
o.Configure(c, o.Authorizers.ResourceManager)
})
if err != nil {
return nil, fmt.Errorf("building clients for Network: %+v", err)
}

return &Client{
Client: client,
}, nil
}
Loading