@@ -2,6 +2,7 @@ package provider_test
22
33import (
44 "fmt"
5+ "regexp"
56 "testing"
67
78 "github.com/hashicorp/terraform-plugin-testing/config"
@@ -322,6 +323,25 @@ func TestAccIkeGateway_ProtocolIkev2(t *testing.T) {
322323 })
323324}
324325
326+ func TestAccIkeGateway_PlaintextValueMissingRejected (t * testing.T ) {
327+ nameSuffix := acctest .RandStringFromCharSet (6 , acctest .CharSetAlphaNum )
328+ prefix := fmt .Sprintf ("test-acc-%s" , nameSuffix )
329+
330+ resource .ParallelTest (t , resource.TestCase {
331+ PreCheck : func () { testAccPreCheck (t ) },
332+ ProtoV6ProviderFactories : testAccProviders ,
333+ Steps : []resource.TestStep {
334+ {
335+ Config : ikeGatewayConfig_PlaintextValueMissing ,
336+ ConfigVariables : map [string ]config.Variable {
337+ "prefix" : config .StringVariable (prefix ),
338+ },
339+ ExpectError : regexp .MustCompile (`The attribute at path.+` ),
340+ },
341+ },
342+ })
343+ }
344+
325345const ikeGatewayConfig_Basic = `
326346variable "prefix" { type = string }
327347
@@ -760,3 +780,42 @@ resource "panos_template" "example" {
760780 name = format("%s-tmpl", var.prefix)
761781}
762782`
783+
784+ const ikeGatewayConfig_PlaintextValueMissing = `
785+ variable "prefix" { type = string }
786+
787+ resource "panos_ike_gateway" "example" {
788+ location = { template = { name = panos_template.example.name } }
789+
790+ name = format("%s-gw1", var.prefix)
791+
792+ authentication = {
793+ pre_shared_key = {
794+ key = "[PLAINTEXT-VALUE-MISSING]"
795+ }
796+ }
797+
798+ local_address = {
799+ interface = panos_ethernet_interface.example.name
800+ }
801+
802+ peer_address = {
803+ ip = "10.10.0.1/32"
804+ }
805+ }
806+
807+ resource "panos_ethernet_interface" "example" {
808+ location = { template = { name = panos_template.example.name, vsys = "vsys1" } }
809+
810+ name = "ethernet1/1"
811+
812+ layer3 = {
813+ ips = [{ name = "10.0.0.1/32" }]
814+ }
815+ }
816+
817+ resource "panos_template" "example" {
818+ location = { panorama = {} }
819+ name = format("%s-tmpl", var.prefix)
820+ }
821+ `
0 commit comments