PaloAltoNetworks / terraform-provider-cloudngfwaws

The Terraform provider for the Palo Alto Networks AWS cloud NGFW
Mozilla Public License 2.0
14 stars 14 forks source link

CustomerManaged endpoints cannot be created due to lack of AZ property on NGFW resource #5

Closed ShreyasNBS closed 2 years ago

ShreyasNBS commented 2 years ago

When creating a new NGFW with following code

resource "cloudngfwaws_ngfw" "test-ngfw-terraform" {
  name        = "test-ngfw-terraform"
  vpc_id      = aws_vpc.inspection-vpc.id
  account_id  = var.account-id
  description = "Test NGFW created via terraform provider"

  endpoint_mode = "CustomerManaged"
  subnet_mapping {
    subnet_id = aws_subnet.inspection-private-1-subnet.id
  }

  subnet_mapping {
    subnet_id = aws_subnet.inspection-private-2-subnet.id
  }

  rulestack = cloudngfwaws_rulestack.test-rulestack-terraform.name

  tags = {
    Foo = "bar"
  }
}

I get the following error

│ Error: Error(1): Customer Managed endpoint can only have AvailabilityZone
│ 
│   with module.base.cloudngfwaws_ngfw.test-ngfw-terraform,
│   on modules/base/palo-ngfw.tf line 1, in resource "cloudngfwaws_ngfw" "test-ngfw-terraform":
│    1: resource "cloudngfwaws_ngfw" "test-ngfw-terraform" {

However on the NGFW resource I cannot seem to find properties for adding AZ. So as things stand, I am unable to create an NGFW with CustomerManaged endpoints. Can you please point me in the right direction?

Thanks, Shreyas

shinmog commented 2 years ago

So it seems that if you're going to be doing endpoint_mode="ServiceManaged" then you specify the subnet_id in the subnet mappings, but if you're doing endpoint_mode="CustomerManaged" you need to specify az in the subnet mappings.

Since az isn't descriptive enough, I've changed this to availability_zone instead.

I've also updated the docs to point out when to use subnet_id vs when to use availability_zone.

ShreyasNBS commented 2 years ago

Thank you. That's clear enough now.