From fd8d0473aed18692434a43812fbb8732efb0227b Mon Sep 17 00:00:00 2001 From: Sean Conroy Date: Tue, 2 Jul 2024 13:52:09 +0100 Subject: [PATCH] Add environment varaible test value options --- .../policy_object_class_map.yaml | 10 +---- .../profile_parcels/policy_object_color.yaml | 10 +---- .../policy_object_data_ipv6_prefix.yaml | 10 +---- .../policy_object_data_prefix.yaml | 12 ++---- .../policy_object_expanded_community.yaml | 10 +---- .../policy_object_extended_community.yaml | 10 +---- .../policy_object_ipv6_prefix.yaml | 10 +---- .../profile_parcels/policy_object_mirror.yaml | 10 +---- .../policy_object_policer.yaml | 10 +---- .../profile_parcels/policy_object_prefix.yaml | 10 +---- .../profile_parcels/policy_object_tloc.yaml | 10 +---- gen/generator.go | 1 + gen/schema/schema.yaml | 1 + .../profile_parcels/data_source_test.go | 18 ++++----- .../profile_parcels/resource_test.go | 40 +++++++++---------- ...cy_object_class_map_profile_parcel_test.go | 17 +++----- ...policy_object_color_profile_parcel_test.go | 17 +++----- ...ct_data_ipv6_prefix_profile_parcel_test.go | 17 +++----- ..._object_data_prefix_profile_parcel_test.go | 17 +++----- ..._expanded_community_profile_parcel_test.go | 17 +++----- ..._extended_community_profile_parcel_test.go | 17 +++----- ..._object_ipv6_prefix_profile_parcel_test.go | 17 +++----- ...olicy_object_mirror_profile_parcel_test.go | 17 +++----- ...licy_object_policer_profile_parcel_test.go | 17 +++----- ...olicy_object_prefix_profile_parcel_test.go | 17 +++----- ..._policy_object_tloc_profile_parcel_test.go | 17 +++----- ...cy_object_class_map_profile_parcel_test.go | 19 +++------ ...policy_object_color_profile_parcel_test.go | 19 +++------ ...ct_data_ipv6_prefix_profile_parcel_test.go | 19 +++------ ..._object_data_prefix_profile_parcel_test.go | 19 +++------ ..._expanded_community_profile_parcel_test.go | 19 +++------ ..._extended_community_profile_parcel_test.go | 19 +++------ ..._object_ipv6_prefix_profile_parcel_test.go | 19 +++------ ...olicy_object_mirror_profile_parcel_test.go | 19 +++------ ...licy_object_policer_profile_parcel_test.go | 19 +++------ ...olicy_object_prefix_profile_parcel_test.go | 19 +++------ ..._policy_object_tloc_profile_parcel_test.go | 19 +++------ 37 files changed, 175 insertions(+), 393 deletions(-) diff --git a/gen/definitions/profile_parcels/policy_object_class_map.yaml b/gen/definitions/profile_parcels/policy_object_class_map.yaml index 6fb824ff..2a2e9898 100644 --- a/gen/definitions/profile_parcels/policy_object_class_map.yaml +++ b/gen/definitions/profile_parcels/policy_object_class_map.yaml @@ -2,7 +2,7 @@ name: Policy Object Class Map rest_endpoint: /v1/feature-profile/sdwan/policy-object/%v/class minimum_version: 20.12.0 -test_tags: [SDWAN_2012] +test_tags: [SDWAN_2012, POLICY_OBJECT_FEATURE_TEMPLATE_ID] attributes: - tf_name: feature_profile_id reference: true @@ -10,7 +10,7 @@ attributes: mandatory: true description: Feature Profile ID example: f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac - test_value: sdwan_policy_object_feature_profile.test.id + test_env_name: POLICY_OBJECT_FEATURE_TEMPLATE_ID - model_name: entries mandatory: true attributes: @@ -19,9 +19,3 @@ attributes: mandatory: true example: 0 minimum_test_value: 0 - -test_prerequisites: | - resource "sdwan_policy_object_feature_profile" "test" { - name = "TF_TEST" - description = "Terraform test" - } \ No newline at end of file diff --git a/gen/definitions/profile_parcels/policy_object_color.yaml b/gen/definitions/profile_parcels/policy_object_color.yaml index 80544712..f3f66f00 100644 --- a/gen/definitions/profile_parcels/policy_object_color.yaml +++ b/gen/definitions/profile_parcels/policy_object_color.yaml @@ -2,7 +2,7 @@ name: Policy Object Color rest_endpoint: /v1/feature-profile/sdwan/policy-object/%v/color minimum_version: 20.12.0 -test_tags: [SDWAN_2012] +test_tags: [SDWAN_2012, POLICY_OBJECT_FEATURE_TEMPLATE_ID] attributes: - tf_name: feature_profile_id reference: true @@ -10,7 +10,7 @@ attributes: mandatory: true description: Feature Profile ID example: f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac - test_value: sdwan_policy_object_feature_profile.test.id + test_env_name: POLICY_OBJECT_FEATURE_TEMPLATE_ID - model_name: entries mandatory: true attributes: @@ -19,9 +19,3 @@ attributes: mandatory: true example: blue minimum_test_value: '"blue"' - -test_prerequisites: | - resource "sdwan_policy_object_feature_profile" "test" { - name = "TF_TEST" - description = "Terraform test" - } \ No newline at end of file diff --git a/gen/definitions/profile_parcels/policy_object_data_ipv6_prefix.yaml b/gen/definitions/profile_parcels/policy_object_data_ipv6_prefix.yaml index 6560e0cf..3b97f95b 100644 --- a/gen/definitions/profile_parcels/policy_object_data_ipv6_prefix.yaml +++ b/gen/definitions/profile_parcels/policy_object_data_ipv6_prefix.yaml @@ -2,7 +2,7 @@ name: Policy Object Data IPv6 Prefix rest_endpoint: /v1/feature-profile/sdwan/policy-object/%v/data-ipv6-prefix minimum_version: 20.12.0 -test_tags: [SDWAN_2012] +test_tags: [SDWAN_2012, POLICY_OBJECT_FEATURE_TEMPLATE_ID] attributes: - tf_name: feature_profile_id reference: true @@ -10,7 +10,7 @@ attributes: mandatory: true description: Feature Profile ID example: f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac - test_value: sdwan_policy_object_feature_profile.test.id + test_env_name: POLICY_OBJECT_FEATURE_TEMPLATE_ID - model_name: entries mandatory: true attributes: @@ -23,9 +23,3 @@ attributes: mandatory: true example: 64 minimum_test_value: '64' - -test_prerequisites: | - resource "sdwan_policy_object_feature_profile" "test" { - name = "TF_TEST" - description = "Terraform test" - } \ No newline at end of file diff --git a/gen/definitions/profile_parcels/policy_object_data_prefix.yaml b/gen/definitions/profile_parcels/policy_object_data_prefix.yaml index 3ca91c3b..c420902e 100644 --- a/gen/definitions/profile_parcels/policy_object_data_prefix.yaml +++ b/gen/definitions/profile_parcels/policy_object_data_prefix.yaml @@ -2,7 +2,7 @@ name: Policy Object Data Prefix rest_endpoint: /v1/feature-profile/sdwan/policy-object/%v/data-prefix minimum_version: 20.12.0 -test_tags: [SDWAN_2012] +test_tags: [SDWAN_2012, POLICY_OBJECT_FEATURE_TEMPLATE_ID] attributes: - tf_name: feature_profile_id reference: true @@ -10,7 +10,7 @@ attributes: mandatory: true description: Feature Profile ID example: f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac - test_value: sdwan_policy_object_feature_profile.test.id + test_env_name: POLICY_OBJECT_FEATURE_TEMPLATE_ID - model_name: entries mandatory: true attributes: @@ -22,10 +22,4 @@ attributes: - model_name: ipv4PrefixLength mandatory: true example: 8 - minimum_test_value: '8' - -test_prerequisites: | - resource "sdwan_policy_object_feature_profile" "test" { - name = "TF_TEST" - description = "Terraform test" - } \ No newline at end of file + minimum_test_value: '8' \ No newline at end of file diff --git a/gen/definitions/profile_parcels/policy_object_expanded_community.yaml b/gen/definitions/profile_parcels/policy_object_expanded_community.yaml index 1c94bb83..22d67bed 100644 --- a/gen/definitions/profile_parcels/policy_object_expanded_community.yaml +++ b/gen/definitions/profile_parcels/policy_object_expanded_community.yaml @@ -2,7 +2,7 @@ name: Policy Object Expanded Community rest_endpoint: /v1/feature-profile/sdwan/policy-object/%v/expanded-community minimum_version: 20.12.0 -test_tags: [SDWAN_2012] +test_tags: [SDWAN_2012, POLICY_OBJECT_FEATURE_TEMPLATE_ID] attributes: - tf_name: feature_profile_id reference: true @@ -10,15 +10,9 @@ attributes: mandatory: true description: Feature Profile ID example: f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac - test_value: sdwan_policy_object_feature_profile.test.id + test_env_name: POLICY_OBJECT_FEATURE_TEMPLATE_ID - model_name: expandedCommunityList tf_name: expanded_community_lists id: true mandatory: true example: abcd - -test_prerequisites: | - resource "sdwan_policy_object_feature_profile" "test" { - name = "TF_TEST" - description = "Terraform test" - } \ No newline at end of file diff --git a/gen/definitions/profile_parcels/policy_object_extended_community.yaml b/gen/definitions/profile_parcels/policy_object_extended_community.yaml index b341090e..8fd6ed85 100644 --- a/gen/definitions/profile_parcels/policy_object_extended_community.yaml +++ b/gen/definitions/profile_parcels/policy_object_extended_community.yaml @@ -2,7 +2,7 @@ name: Policy Object Extended Community rest_endpoint: /v1/feature-profile/sdwan/policy-object/%v/ext-community minimum_version: 20.12.0 -test_tags: [SDWAN_2012] +test_tags: [SDWAN_2012, POLICY_OBJECT_FEATURE_TEMPLATE_ID] attributes: - tf_name: feature_profile_id reference: true @@ -10,7 +10,7 @@ attributes: mandatory: true description: Feature Profile ID example: f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac - test_value: sdwan_policy_object_feature_profile.test.id + test_env_name: POLICY_OBJECT_FEATURE_TEMPLATE_ID - model_name: entries mandatory: true attributes: @@ -20,9 +20,3 @@ attributes: mandatory: true example: "soo 10.0.0.1:30" minimum_test_value: '"soo 10.0.0.1:30"' - -test_prerequisites: | - resource "sdwan_policy_object_feature_profile" "test" { - name = "TF_TEST" - description = "Terraform test" - } \ No newline at end of file diff --git a/gen/definitions/profile_parcels/policy_object_ipv6_prefix.yaml b/gen/definitions/profile_parcels/policy_object_ipv6_prefix.yaml index eae11fa1..5864c030 100644 --- a/gen/definitions/profile_parcels/policy_object_ipv6_prefix.yaml +++ b/gen/definitions/profile_parcels/policy_object_ipv6_prefix.yaml @@ -2,7 +2,7 @@ name: Policy Object IPv6 Prefix rest_endpoint: /v1/feature-profile/sdwan/policy-object/%v/ipv6-prefix minimum_version: 20.12.0 -test_tags: [SDWAN_2012] +test_tags: [SDWAN_2012, POLICY_OBJECT_FEATURE_TEMPLATE_ID] attributes: - tf_name: feature_profile_id reference: true @@ -10,7 +10,7 @@ attributes: mandatory: true description: Feature Profile ID example: f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac - test_value: sdwan_policy_object_feature_profile.test.id + test_env_name: POLICY_OBJECT_FEATURE_TEMPLATE_ID - model_name: entries mandatory: true attributes: @@ -28,9 +28,3 @@ attributes: example: 100 - model_name: geRangePrefixLength example: 70 - -test_prerequisites: | - resource "sdwan_policy_object_feature_profile" "test" { - name = "TF_TEST" - description = "Terraform test" - } \ No newline at end of file diff --git a/gen/definitions/profile_parcels/policy_object_mirror.yaml b/gen/definitions/profile_parcels/policy_object_mirror.yaml index 98917689..5e09db2d 100644 --- a/gen/definitions/profile_parcels/policy_object_mirror.yaml +++ b/gen/definitions/profile_parcels/policy_object_mirror.yaml @@ -2,7 +2,7 @@ name: Policy Object Mirror rest_endpoint: /v1/feature-profile/sdwan/policy-object/%v/mirror minimum_version: 20.12.0 -test_tags: [SDWAN_2012] +test_tags: [SDWAN_2012, POLICY_OBJECT_FEATURE_TEMPLATE_ID] attributes: - tf_name: feature_profile_id reference: true @@ -10,7 +10,7 @@ attributes: mandatory: true description: Feature Profile ID example: f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac - test_value: sdwan_policy_object_feature_profile.test.id + test_env_name: POLICY_OBJECT_FEATURE_TEMPLATE_ID - model_name: entries mandatory: true attributes: @@ -26,9 +26,3 @@ attributes: mandatory: true example: 10.0.0.2 minimum_test_value: '"10.0.0.2"' - -test_prerequisites: | - resource "sdwan_policy_object_feature_profile" "test" { - name = "TF_TEST" - description = "Terraform test" - } \ No newline at end of file diff --git a/gen/definitions/profile_parcels/policy_object_policer.yaml b/gen/definitions/profile_parcels/policy_object_policer.yaml index f2b972a3..2cadf673 100644 --- a/gen/definitions/profile_parcels/policy_object_policer.yaml +++ b/gen/definitions/profile_parcels/policy_object_policer.yaml @@ -2,7 +2,7 @@ name: Policy Object Policer rest_endpoint: /v1/feature-profile/sdwan/policy-object/%v/policer minimum_version: 20.12.0 -test_tags: [SDWAN_2012] +test_tags: [SDWAN_2012, POLICY_OBJECT_FEATURE_TEMPLATE_ID] attributes: - tf_name: feature_profile_id reference: true @@ -10,7 +10,7 @@ attributes: mandatory: true description: Feature Profile ID example: f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac - test_value: sdwan_policy_object_feature_profile.test.id + test_env_name: POLICY_OBJECT_FEATURE_TEMPLATE_ID - model_name: entries mandatory: true attributes: @@ -32,9 +32,3 @@ attributes: mandatory: true example: 60000 minimum_test_value: '60000' - -test_prerequisites: | - resource "sdwan_policy_object_feature_profile" "test" { - name = "TF_TEST" - description = "Terraform test" - } \ No newline at end of file diff --git a/gen/definitions/profile_parcels/policy_object_prefix.yaml b/gen/definitions/profile_parcels/policy_object_prefix.yaml index 34c0c852..e699b4c9 100644 --- a/gen/definitions/profile_parcels/policy_object_prefix.yaml +++ b/gen/definitions/profile_parcels/policy_object_prefix.yaml @@ -2,7 +2,7 @@ name: Policy Object Prefix rest_endpoint: /v1/feature-profile/sdwan/policy-object/%v/prefix minimum_version: 20.12.0 -test_tags: [SDWAN_2012] +test_tags: [SDWAN_2012, POLICY_OBJECT_FEATURE_TEMPLATE_ID] attributes: - tf_name: feature_profile_id reference: true @@ -10,7 +10,7 @@ attributes: mandatory: true description: Feature Profile ID example: f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac - test_value: sdwan_policy_object_feature_profile.test.id + test_env_name: POLICY_OBJECT_FEATURE_TEMPLATE_ID - model_name: entries mandatory: true attributes: @@ -28,9 +28,3 @@ attributes: example: 24 - model_name: geRangePrefixLength example: 16 - -test_prerequisites: | - resource "sdwan_policy_object_feature_profile" "test" { - name = "TF_TEST" - description = "Terraform test" - } \ No newline at end of file diff --git a/gen/definitions/profile_parcels/policy_object_tloc.yaml b/gen/definitions/profile_parcels/policy_object_tloc.yaml index b5e06dd9..680d79a7 100644 --- a/gen/definitions/profile_parcels/policy_object_tloc.yaml +++ b/gen/definitions/profile_parcels/policy_object_tloc.yaml @@ -2,7 +2,7 @@ name: Policy Object TLOC rest_endpoint: /v1/feature-profile/sdwan/policy-object/%v/tloc minimum_version: 20.12.0 -test_tags: [SDWAN_2012] +test_tags: [SDWAN_2012, POLICY_OBJECT_FEATURE_TEMPLATE_ID] attributes: - tf_name: feature_profile_id reference: true @@ -10,7 +10,7 @@ attributes: mandatory: true description: Feature Profile ID example: f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac - test_value: sdwan_policy_object_feature_profile.test.id + test_env_name: POLICY_OBJECT_FEATURE_TEMPLATE_ID - model_name: entries mandatory: true attributes: @@ -30,9 +30,3 @@ attributes: minimum_test_value: '"gre"' - model_name: preference example: 33 - -test_prerequisites: | - resource "sdwan_policy_object_feature_profile" "test" { - name = "TF_TEST" - description = "Terraform test" - } \ No newline at end of file diff --git a/gen/generator.go b/gen/generator.go index a196320b..3bac7db7 100644 --- a/gen/generator.go +++ b/gen/generator.go @@ -254,6 +254,7 @@ type YamlConfigAttribute struct { Value string `yaml:"value"` TestValue string `yaml:"test_value"` MinimumTestValue string `yaml:"minimum_test_value"` + TestEnvName string `yaml:"test_env_name"` AlwaysInclude bool `yaml:"always_include"` Attributes []YamlConfigAttribute `yaml:"attributes"` ConditionalAttribute YamlConfigConditionalAttribute `yaml:"conditional_attribute"` diff --git a/gen/schema/schema.yaml b/gen/schema/schema.yaml index 95063099..ffc16455 100644 --- a/gen/schema/schema.yaml +++ b/gen/schema/schema.yaml @@ -67,6 +67,7 @@ attribute: value: any(str(), int(), bool(), required=False) # Hardcoded value for the attribute test_value: str(required=False) # Value used for acceptance test minimum_test_value: any(str(), int(), bool(), num(), required=False) # Value used for "minimum" resource acceptance test + test_env_name: str(required=False) # Environment variable name for viable containing resource ID used for testing always_include: bool(required=False) # Include attribute always in payload attributes: list(include('attribute'), required=False) # List of attributes, only relevant if type is "List" or "Set" conditional_attribute: include('conditional_attribute', required=False) # Add attribute to payload only if condition is true diff --git a/gen/templates/profile_parcels/data_source_test.go b/gen/templates/profile_parcels/data_source_test.go index 5e231a73..3155c816 100644 --- a/gen/templates/profile_parcels/data_source_test.go +++ b/gen/templates/profile_parcels/data_source_test.go @@ -160,10 +160,10 @@ func testAccDataSourceSdwan{{camelCase .Name}}ProfileParcelConfig() string { {{- if and (not .ExcludeTest) (not .Value)}} {{- if len .TestTags}} if {{range $i, $e := .TestTags}}{{if $i}} || {{end}}os.Getenv("{{$e}}") != ""{{end}} { - config += ` {{.TfName}} = {{if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}}` + "\n" + config += ` {{.TfName}} = {{if .TestEnvName}}` + os.Getenv("{{.TestEnvName}}") + `{{else if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}}` + "\n" } {{- else}} - config += ` {{.TfName}} = {{if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}}` + "\n" + config += ` {{.TfName}} = {{if .TestEnvName}}` + os.Getenv("{{.TestEnvName}}") + `{{else if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}}` + "\n" {{- end}} {{- end}} {{- end}} @@ -174,10 +174,10 @@ func testAccDataSourceSdwan{{camelCase .Name}}ProfileParcelConfig() string { {{- else}} {{- if len .TestTags}} if {{range $i, $e := .TestTags}}{{if $i}} || {{end}}os.Getenv("{{$e}}") != ""{{end}} { - config += ` {{.TfName}} = {{if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}}` + "\n" + config += ` {{.TfName}} = {{if .TestEnvName}}` + os.Getenv("{{.TestEnvName}}") + `{{else if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}}` + "\n" } {{- else}} - config += ` {{.TfName}} = {{if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}}` + "\n" + config += ` {{.TfName}} = {{if .TestEnvName}}` + os.Getenv("{{.TestEnvName}}") + `{{else if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}}` + "\n" {{- end}} {{- end}} {{- end}} @@ -189,10 +189,10 @@ func testAccDataSourceSdwan{{camelCase .Name}}ProfileParcelConfig() string { {{- else}} {{- if len .TestTags}} if {{range $i, $e := .TestTags}}{{if $i}} || {{end}}os.Getenv("{{$e}}") != ""{{end}} { - config += ` {{.TfName}} = {{if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}}` + "\n" + config += ` {{.TfName}} = {{if .TestEnvName}}` + os.Getenv("{{.TestEnvName}}") + `{{else if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}}` + "\n" } {{- else}} - config += ` {{.TfName}} = {{if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}}` + "\n" + config += ` {{.TfName}} = {{if .TestEnvName}}` + os.Getenv("{{.TestEnvName}}") + `{{else if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}}` + "\n" {{- end}} {{- end}} {{- end}} @@ -204,10 +204,10 @@ func testAccDataSourceSdwan{{camelCase .Name}}ProfileParcelConfig() string { {{- else}} {{- if len .TestTags}} if {{range $i, $e := .TestTags}}{{if $i}} || {{end}}os.Getenv("{{$e}}") != ""{{end}} { - config += ` {{.TfName}} = {{if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}}` + "\n" + config += ` {{.TfName}} = {{if .TestEnvName}}` + os.Getenv("{{.TestEnvName}}") + `{{else if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}}` + "\n" } {{- else}} - config += ` {{.TfName}} = {{if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}}` + "\n" + config += ` {{.TfName}} = {{if .TestEnvName}}` + os.Getenv("{{.TestEnvName}}") + `{{else if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}}` + "\n" {{- end}} {{- end}} {{- end}} @@ -219,7 +219,7 @@ func testAccDataSourceSdwan{{camelCase .Name}}ProfileParcelConfig() string { id = sdwan_{{snakeCase $name}}_profile_parcel.test.id {{- range .Attributes}} {{- if .Reference}} - {{.TfName}} = {{if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}} + {{.TfName}} = {{if .TestEnvName}}` + os.Getenv("{{.TestEnvName}}") + `{{else if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}} {{- end}} {{- end}} } diff --git a/gen/templates/profile_parcels/resource_test.go b/gen/templates/profile_parcels/resource_test.go index 5387c7b5..5ddfe609 100644 --- a/gen/templates/profile_parcels/resource_test.go +++ b/gen/templates/profile_parcels/resource_test.go @@ -139,34 +139,34 @@ func testAccSdwan{{camelCase .Name}}ProfileParcelConfig_minimum() string { config += ` name = "TF_TEST_MIN"` + "\n" config += ` description = "Terraform integration test"` + "\n" {{- range .Attributes}} - {{- if and (or .Reference .Mandatory .MinimumTestValue) (not .Optional)}} + {{- if and (or .Reference .Mandatory .MinimumTestValue .TestEnvName) (not .Optional)}} {{- if isNestedListSet .}} {{- if len .TestTags}} if {{range $i, $e := .TestTags}}{{if $i}} || {{end}}os.Getenv("{{$e}}") != ""{{end}} { {{- end}} config += ` {{.TfName}} = [{` + "\n" {{- range .Attributes}} - {{- if and (or .Reference .Mandatory .MinimumTestValue) (not .Optional)}} + {{- if and (or .Reference .Mandatory .MinimumTestValue .TestEnvName) (not .Optional)}} {{- if isNestedListSet .}} {{- if len .TestTags}} if {{range $i, $e := .TestTags}}{{if $i}} || {{end}}os.Getenv("{{$e}}") != ""{{end}} { {{- end}} config += ` {{.TfName}} = [{` + "\n" {{- range .Attributes}} - {{- if and (or .Reference .Mandatory .MinimumTestValue) (not .Optional)}} + {{- if and (or .Reference .Mandatory .MinimumTestValue .TestEnvName) (not .Optional)}} {{- if isNestedListSet .}} {{- if len .TestTags}} if {{range $i, $e := .TestTags}}{{if $i}} || {{end}}os.Getenv("{{$e}}") != ""{{end}} { {{- end}} config += ` {{.TfName}} = [{` + "\n" {{- range .Attributes}} - {{- if and (or .Reference .Mandatory .MinimumTestValue) (not .Optional)}} + {{- if and (or .Reference .Mandatory .MinimumTestValue .TestEnvName) (not .Optional)}} {{- if len .TestTags}} if {{range $i, $e := .TestTags}}{{if $i}} || {{end}}os.Getenv("{{$e}}") != ""{{end}} { - config += ` {{.TfName}} = {{if .MinimumTestValue}}{{.MinimumTestValue}}{{else if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}}` + "\n" + config += ` {{.TfName}} = {{if .TestEnvName}}` + os.Getenv("{{.TestEnvName}}") + `{{else if .MinimumTestValue}}{{.MinimumTestValue}}{{else if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}}` + "\n" } {{- else}} - config += ` {{.TfName}} = {{if .MinimumTestValue}}{{.MinimumTestValue}}{{else if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}}` + "\n" + config += ` {{.TfName}} = {{if .TestEnvName}}` + os.Getenv("{{.TestEnvName}}") + `{{else if .MinimumTestValue}}{{.MinimumTestValue}}{{else if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}}` + "\n" {{- end}} {{- end}} {{- end}} @@ -177,10 +177,10 @@ func testAccSdwan{{camelCase .Name}}ProfileParcelConfig_minimum() string { {{- else}} {{- if len .TestTags}} if {{range $i, $e := .TestTags}}{{if $i}} || {{end}}os.Getenv("{{$e}}") != ""{{end}} { - config += ` {{.TfName}} = {{if .MinimumTestValue}}{{.MinimumTestValue}}{{else if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}}` + "\n" + config += ` {{.TfName}} = {{if .TestEnvName}}` + os.Getenv("{{.TestEnvName}}") + `{{else if .MinimumTestValue}}{{.MinimumTestValue}}{{else if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}}` + "\n" } {{- else}} - config += ` {{.TfName}} = {{if .MinimumTestValue}}{{.MinimumTestValue}}{{else if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}}` + "\n" + config += ` {{.TfName}} = {{if .TestEnvName}}` + os.Getenv("{{.TestEnvName}}") + `{{else if .MinimumTestValue}}{{.MinimumTestValue}}{{else if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}}` + "\n" {{- end}} {{- end}} {{- end}} @@ -192,10 +192,10 @@ func testAccSdwan{{camelCase .Name}}ProfileParcelConfig_minimum() string { {{- else}} {{- if len .TestTags}} if {{range $i, $e := .TestTags}}{{if $i}} || {{end}}os.Getenv("{{$e}}") != ""{{end}} { - config += ` {{.TfName}} = {{if .MinimumTestValue}}{{.MinimumTestValue}}{{else if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}}` + "\n" + config += ` {{.TfName}} = {{if .TestEnvName}}` + os.Getenv("{{.TestEnvName}}") + `{{else if .MinimumTestValue}}{{.MinimumTestValue}}{{else if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}}` + "\n" } {{- else}} - config += ` {{.TfName}} = {{if .MinimumTestValue}}{{.MinimumTestValue}}{{else if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}}` + "\n" + config += ` {{.TfName}} = {{if .TestEnvName}}` + os.Getenv("{{.TestEnvName}}") + `{{else if .MinimumTestValue}}{{.MinimumTestValue}}{{else if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}}` + "\n" {{- end}} {{- end}} {{- end}} @@ -207,10 +207,10 @@ func testAccSdwan{{camelCase .Name}}ProfileParcelConfig_minimum() string { {{- else}} {{- if len .TestTags}} if {{range $i, $e := .TestTags}}{{if $i}} || {{end}}os.Getenv("{{$e}}") != ""{{end}} { - config += ` {{.TfName}} = {{if .MinimumTestValue}}{{.MinimumTestValue}}{{else if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}}` + "\n" + config += ` {{.TfName}} = {{if .TestEnvName}}` + os.Getenv("{{.TestEnvName}}") + `{{else if .MinimumTestValue}}{{.MinimumTestValue}}{{else if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}}` + "\n" } {{- else}} - config += ` {{.TfName}} = {{if .MinimumTestValue}}{{.MinimumTestValue}}{{else if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}}` + "\n" + config += ` {{.TfName}} = {{if .TestEnvName}}` + os.Getenv("{{.TestEnvName}}") + `{{else if .MinimumTestValue}}{{.MinimumTestValue}}{{else if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}}` + "\n" {{- end}} {{- end}} {{- end}} @@ -250,10 +250,10 @@ func testAccSdwan{{camelCase .Name}}ProfileParcelConfig_all() string { {{- if and (not .ExcludeTest) (not .Value)}} {{- if len .TestTags}} if {{range $i, $e := .TestTags}}{{if $i}} || {{end}}os.Getenv("{{$e}}") != ""{{end}} { - config += ` {{.TfName}} = {{if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}}` + "\n" + config += ` {{.TfName}} = {{if .TestEnvName}}` + os.Getenv("{{.TestEnvName}}") + `{{else if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}}` + "\n" } {{- else}} - config += ` {{.TfName}} = {{if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}}` + "\n" + config += ` {{.TfName}} = {{if .TestEnvName}}` + os.Getenv("{{.TestEnvName}}") + `{{else if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}}` + "\n" {{- end}} {{- end}} {{- end}} @@ -264,10 +264,10 @@ func testAccSdwan{{camelCase .Name}}ProfileParcelConfig_all() string { {{- else}} {{- if len .TestTags}} if {{range $i, $e := .TestTags}}{{if $i}} || {{end}}os.Getenv("{{$e}}") != ""{{end}} { - config += ` {{.TfName}} = {{if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}}` + "\n" + config += ` {{.TfName}} = {{if .TestEnvName}}` + os.Getenv("{{.TestEnvName}}") + `{{else if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}}` + "\n" } {{- else}} - config += ` {{.TfName}} = {{if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}}` + "\n" + config += ` {{.TfName}} = {{if .TestEnvName}}` + os.Getenv("{{.TestEnvName}}") + `{{else if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}}` + "\n" {{- end}} {{- end}} {{- end}} @@ -279,10 +279,10 @@ func testAccSdwan{{camelCase .Name}}ProfileParcelConfig_all() string { {{- else}} {{- if len .TestTags}} if {{range $i, $e := .TestTags}}{{if $i}} || {{end}}os.Getenv("{{$e}}") != ""{{end}} { - config += ` {{.TfName}} = {{if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}}` + "\n" + config += ` {{.TfName}} = {{if .TestEnvName}}` + os.Getenv("{{.TestEnvName}}") + `{{else if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}}` + "\n" } {{- else}} - config += ` {{.TfName}} = {{if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}}` + "\n" + config += ` {{.TfName}} = {{if .TestEnvName}}` + os.Getenv("{{.TestEnvName}}") + `{{else if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}}` + "\n" {{- end}} {{- end}} {{- end}} @@ -294,10 +294,10 @@ func testAccSdwan{{camelCase .Name}}ProfileParcelConfig_all() string { {{- else}} {{- if len .TestTags}} if {{range $i, $e := .TestTags}}{{if $i}} || {{end}}os.Getenv("{{$e}}") != ""{{end}} { - config += ` {{.TfName}} = {{if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}}` + "\n" + config += ` {{.TfName}} = {{if .TestEnvName}}` + os.Getenv("{{.TestEnvName}}") + `{{else if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}}` + "\n" } {{- else}} - config += ` {{.TfName}} = {{if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}}` + "\n" + config += ` {{.TfName}} = {{if .TestEnvName}}` + os.Getenv("{{.TestEnvName}}") + `{{else if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}}` + "\n" {{- end}} {{- end}} {{- end}} diff --git a/internal/provider/data_source_sdwan_policy_object_class_map_profile_parcel_test.go b/internal/provider/data_source_sdwan_policy_object_class_map_profile_parcel_test.go index 199c3c94..0ef5af3c 100644 --- a/internal/provider/data_source_sdwan_policy_object_class_map_profile_parcel_test.go +++ b/internal/provider/data_source_sdwan_policy_object_class_map_profile_parcel_test.go @@ -29,8 +29,8 @@ import ( // Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSource func TestAccDataSourceSdwanPolicyObjectClassMapProfileParcel(t *testing.T) { - if os.Getenv("SDWAN_2012") == "" { - t.Skip("skipping test, set environment variable SDWAN_2012") + if os.Getenv("SDWAN_2012") == "" && os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") == "" { + t.Skip("skipping test, set environment variable SDWAN_2012 or POLICY_OBJECT_FEATURE_TEMPLATE_ID") } var checks []resource.TestCheckFunc checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_policy_object_class_map_profile_parcel.test", "entries.0.queue", "0")) @@ -39,7 +39,7 @@ func TestAccDataSourceSdwanPolicyObjectClassMapProfileParcel(t *testing.T) { ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, Steps: []resource.TestStep{ { - Config: testAccDataSourceSdwanPolicyObjectClassMapPrerequisitesProfileParcelConfig + testAccDataSourceSdwanPolicyObjectClassMapProfileParcelConfig(), + Config: testAccDataSourceSdwanPolicyObjectClassMapProfileParcelConfig(), Check: resource.ComposeTestCheckFunc(checks...), }, }, @@ -49,13 +49,6 @@ func TestAccDataSourceSdwanPolicyObjectClassMapProfileParcel(t *testing.T) { // End of section. //template:end testAccDataSource // Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites -const testAccDataSourceSdwanPolicyObjectClassMapPrerequisitesProfileParcelConfig = ` -resource "sdwan_policy_object_feature_profile" "test" { - name = "TF_TEST" - description = "Terraform test" -} -` - // End of section. //template:end testPrerequisites // Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSourceConfig @@ -63,7 +56,7 @@ func testAccDataSourceSdwanPolicyObjectClassMapProfileParcelConfig() string { config := `resource "sdwan_policy_object_class_map_profile_parcel" "test" {` + "\n" config += ` name = "TF_TEST"` + "\n" config += ` description = "Terraform integration test"` + "\n" - config += ` feature_profile_id = sdwan_policy_object_feature_profile.test.id` + "\n" + config += ` feature_profile_id = ` + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + `` + "\n" config += ` entries = [{` + "\n" config += ` queue = "0"` + "\n" config += ` }]` + "\n" @@ -72,7 +65,7 @@ func testAccDataSourceSdwanPolicyObjectClassMapProfileParcelConfig() string { config += ` data "sdwan_policy_object_class_map_profile_parcel" "test" { id = sdwan_policy_object_class_map_profile_parcel.test.id - feature_profile_id = sdwan_policy_object_feature_profile.test.id + feature_profile_id = ` + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + ` } ` return config diff --git a/internal/provider/data_source_sdwan_policy_object_color_profile_parcel_test.go b/internal/provider/data_source_sdwan_policy_object_color_profile_parcel_test.go index cf180903..cdeb5708 100644 --- a/internal/provider/data_source_sdwan_policy_object_color_profile_parcel_test.go +++ b/internal/provider/data_source_sdwan_policy_object_color_profile_parcel_test.go @@ -29,8 +29,8 @@ import ( // Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSource func TestAccDataSourceSdwanPolicyObjectColorProfileParcel(t *testing.T) { - if os.Getenv("SDWAN_2012") == "" { - t.Skip("skipping test, set environment variable SDWAN_2012") + if os.Getenv("SDWAN_2012") == "" && os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") == "" { + t.Skip("skipping test, set environment variable SDWAN_2012 or POLICY_OBJECT_FEATURE_TEMPLATE_ID") } var checks []resource.TestCheckFunc checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_policy_object_color_profile_parcel.test", "entries.0.color", "blue")) @@ -39,7 +39,7 @@ func TestAccDataSourceSdwanPolicyObjectColorProfileParcel(t *testing.T) { ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, Steps: []resource.TestStep{ { - Config: testAccDataSourceSdwanPolicyObjectColorPrerequisitesProfileParcelConfig + testAccDataSourceSdwanPolicyObjectColorProfileParcelConfig(), + Config: testAccDataSourceSdwanPolicyObjectColorProfileParcelConfig(), Check: resource.ComposeTestCheckFunc(checks...), }, }, @@ -49,13 +49,6 @@ func TestAccDataSourceSdwanPolicyObjectColorProfileParcel(t *testing.T) { // End of section. //template:end testAccDataSource // Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites -const testAccDataSourceSdwanPolicyObjectColorPrerequisitesProfileParcelConfig = ` -resource "sdwan_policy_object_feature_profile" "test" { - name = "TF_TEST" - description = "Terraform test" -} -` - // End of section. //template:end testPrerequisites // Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSourceConfig @@ -63,7 +56,7 @@ func testAccDataSourceSdwanPolicyObjectColorProfileParcelConfig() string { config := `resource "sdwan_policy_object_color_profile_parcel" "test" {` + "\n" config += ` name = "TF_TEST"` + "\n" config += ` description = "Terraform integration test"` + "\n" - config += ` feature_profile_id = sdwan_policy_object_feature_profile.test.id` + "\n" + config += ` feature_profile_id = ` + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + `` + "\n" config += ` entries = [{` + "\n" config += ` color = "blue"` + "\n" config += ` }]` + "\n" @@ -72,7 +65,7 @@ func testAccDataSourceSdwanPolicyObjectColorProfileParcelConfig() string { config += ` data "sdwan_policy_object_color_profile_parcel" "test" { id = sdwan_policy_object_color_profile_parcel.test.id - feature_profile_id = sdwan_policy_object_feature_profile.test.id + feature_profile_id = ` + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + ` } ` return config diff --git a/internal/provider/data_source_sdwan_policy_object_data_ipv6_prefix_profile_parcel_test.go b/internal/provider/data_source_sdwan_policy_object_data_ipv6_prefix_profile_parcel_test.go index 82c0c0dd..b95242d6 100644 --- a/internal/provider/data_source_sdwan_policy_object_data_ipv6_prefix_profile_parcel_test.go +++ b/internal/provider/data_source_sdwan_policy_object_data_ipv6_prefix_profile_parcel_test.go @@ -29,8 +29,8 @@ import ( // Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSource func TestAccDataSourceSdwanPolicyObjectDataIPv6PrefixProfileParcel(t *testing.T) { - if os.Getenv("SDWAN_2012") == "" { - t.Skip("skipping test, set environment variable SDWAN_2012") + if os.Getenv("SDWAN_2012") == "" && os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") == "" { + t.Skip("skipping test, set environment variable SDWAN_2012 or POLICY_OBJECT_FEATURE_TEMPLATE_ID") } var checks []resource.TestCheckFunc checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_policy_object_data_ipv6_prefix_profile_parcel.test", "entries.0.ipv6_address", "2001:db8:85a3::8a2e:370:7334")) @@ -40,7 +40,7 @@ func TestAccDataSourceSdwanPolicyObjectDataIPv6PrefixProfileParcel(t *testing.T) ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, Steps: []resource.TestStep{ { - Config: testAccDataSourceSdwanPolicyObjectDataIPv6PrefixPrerequisitesProfileParcelConfig + testAccDataSourceSdwanPolicyObjectDataIPv6PrefixProfileParcelConfig(), + Config: testAccDataSourceSdwanPolicyObjectDataIPv6PrefixProfileParcelConfig(), Check: resource.ComposeTestCheckFunc(checks...), }, }, @@ -50,13 +50,6 @@ func TestAccDataSourceSdwanPolicyObjectDataIPv6PrefixProfileParcel(t *testing.T) // End of section. //template:end testAccDataSource // Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites -const testAccDataSourceSdwanPolicyObjectDataIPv6PrefixPrerequisitesProfileParcelConfig = ` -resource "sdwan_policy_object_feature_profile" "test" { - name = "TF_TEST" - description = "Terraform test" -} -` - // End of section. //template:end testPrerequisites // Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSourceConfig @@ -64,7 +57,7 @@ func testAccDataSourceSdwanPolicyObjectDataIPv6PrefixProfileParcelConfig() strin config := `resource "sdwan_policy_object_data_ipv6_prefix_profile_parcel" "test" {` + "\n" config += ` name = "TF_TEST"` + "\n" config += ` description = "Terraform integration test"` + "\n" - config += ` feature_profile_id = sdwan_policy_object_feature_profile.test.id` + "\n" + config += ` feature_profile_id = ` + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + `` + "\n" config += ` entries = [{` + "\n" config += ` ipv6_address = "2001:db8:85a3::8a2e:370:7334"` + "\n" config += ` ipv6_prefix_length = 64` + "\n" @@ -74,7 +67,7 @@ func testAccDataSourceSdwanPolicyObjectDataIPv6PrefixProfileParcelConfig() strin config += ` data "sdwan_policy_object_data_ipv6_prefix_profile_parcel" "test" { id = sdwan_policy_object_data_ipv6_prefix_profile_parcel.test.id - feature_profile_id = sdwan_policy_object_feature_profile.test.id + feature_profile_id = ` + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + ` } ` return config diff --git a/internal/provider/data_source_sdwan_policy_object_data_prefix_profile_parcel_test.go b/internal/provider/data_source_sdwan_policy_object_data_prefix_profile_parcel_test.go index 0b34e93d..e66aaf17 100644 --- a/internal/provider/data_source_sdwan_policy_object_data_prefix_profile_parcel_test.go +++ b/internal/provider/data_source_sdwan_policy_object_data_prefix_profile_parcel_test.go @@ -29,8 +29,8 @@ import ( // Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSource func TestAccDataSourceSdwanPolicyObjectDataPrefixProfileParcel(t *testing.T) { - if os.Getenv("SDWAN_2012") == "" { - t.Skip("skipping test, set environment variable SDWAN_2012") + if os.Getenv("SDWAN_2012") == "" && os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") == "" { + t.Skip("skipping test, set environment variable SDWAN_2012 or POLICY_OBJECT_FEATURE_TEMPLATE_ID") } var checks []resource.TestCheckFunc checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_policy_object_data_prefix_profile_parcel.test", "entries.0.ipv4_address", "10.0.0.0")) @@ -40,7 +40,7 @@ func TestAccDataSourceSdwanPolicyObjectDataPrefixProfileParcel(t *testing.T) { ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, Steps: []resource.TestStep{ { - Config: testAccDataSourceSdwanPolicyObjectDataPrefixPrerequisitesProfileParcelConfig + testAccDataSourceSdwanPolicyObjectDataPrefixProfileParcelConfig(), + Config: testAccDataSourceSdwanPolicyObjectDataPrefixProfileParcelConfig(), Check: resource.ComposeTestCheckFunc(checks...), }, }, @@ -50,13 +50,6 @@ func TestAccDataSourceSdwanPolicyObjectDataPrefixProfileParcel(t *testing.T) { // End of section. //template:end testAccDataSource // Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites -const testAccDataSourceSdwanPolicyObjectDataPrefixPrerequisitesProfileParcelConfig = ` -resource "sdwan_policy_object_feature_profile" "test" { - name = "TF_TEST" - description = "Terraform test" -} -` - // End of section. //template:end testPrerequisites // Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSourceConfig @@ -64,7 +57,7 @@ func testAccDataSourceSdwanPolicyObjectDataPrefixProfileParcelConfig() string { config := `resource "sdwan_policy_object_data_prefix_profile_parcel" "test" {` + "\n" config += ` name = "TF_TEST"` + "\n" config += ` description = "Terraform integration test"` + "\n" - config += ` feature_profile_id = sdwan_policy_object_feature_profile.test.id` + "\n" + config += ` feature_profile_id = ` + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + `` + "\n" config += ` entries = [{` + "\n" config += ` ipv4_address = "10.0.0.0"` + "\n" config += ` ipv4_prefix_length = 8` + "\n" @@ -74,7 +67,7 @@ func testAccDataSourceSdwanPolicyObjectDataPrefixProfileParcelConfig() string { config += ` data "sdwan_policy_object_data_prefix_profile_parcel" "test" { id = sdwan_policy_object_data_prefix_profile_parcel.test.id - feature_profile_id = sdwan_policy_object_feature_profile.test.id + feature_profile_id = ` + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + ` } ` return config diff --git a/internal/provider/data_source_sdwan_policy_object_expanded_community_profile_parcel_test.go b/internal/provider/data_source_sdwan_policy_object_expanded_community_profile_parcel_test.go index 749b88a8..1a88aff9 100644 --- a/internal/provider/data_source_sdwan_policy_object_expanded_community_profile_parcel_test.go +++ b/internal/provider/data_source_sdwan_policy_object_expanded_community_profile_parcel_test.go @@ -29,8 +29,8 @@ import ( // Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSource func TestAccDataSourceSdwanPolicyObjectExpandedCommunityProfileParcel(t *testing.T) { - if os.Getenv("SDWAN_2012") == "" { - t.Skip("skipping test, set environment variable SDWAN_2012") + if os.Getenv("SDWAN_2012") == "" && os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") == "" { + t.Skip("skipping test, set environment variable SDWAN_2012 or POLICY_OBJECT_FEATURE_TEMPLATE_ID") } var checks []resource.TestCheckFunc resource.Test(t, resource.TestCase{ @@ -38,7 +38,7 @@ func TestAccDataSourceSdwanPolicyObjectExpandedCommunityProfileParcel(t *testing ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, Steps: []resource.TestStep{ { - Config: testAccDataSourceSdwanPolicyObjectExpandedCommunityPrerequisitesProfileParcelConfig + testAccDataSourceSdwanPolicyObjectExpandedCommunityProfileParcelConfig(), + Config: testAccDataSourceSdwanPolicyObjectExpandedCommunityProfileParcelConfig(), Check: resource.ComposeTestCheckFunc(checks...), }, }, @@ -48,13 +48,6 @@ func TestAccDataSourceSdwanPolicyObjectExpandedCommunityProfileParcel(t *testing // End of section. //template:end testAccDataSource // Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites -const testAccDataSourceSdwanPolicyObjectExpandedCommunityPrerequisitesProfileParcelConfig = ` -resource "sdwan_policy_object_feature_profile" "test" { - name = "TF_TEST" - description = "Terraform test" -} -` - // End of section. //template:end testPrerequisites // Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSourceConfig @@ -62,14 +55,14 @@ func testAccDataSourceSdwanPolicyObjectExpandedCommunityProfileParcelConfig() st config := `resource "sdwan_policy_object_expanded_community_profile_parcel" "test" {` + "\n" config += ` name = "TF_TEST"` + "\n" config += ` description = "Terraform integration test"` + "\n" - config += ` feature_profile_id = sdwan_policy_object_feature_profile.test.id` + "\n" + config += ` feature_profile_id = ` + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + `` + "\n" config += ` expanded_community_lists = ["abcd"]` + "\n" config += `}` + "\n" config += ` data "sdwan_policy_object_expanded_community_profile_parcel" "test" { id = sdwan_policy_object_expanded_community_profile_parcel.test.id - feature_profile_id = sdwan_policy_object_feature_profile.test.id + feature_profile_id = ` + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + ` } ` return config diff --git a/internal/provider/data_source_sdwan_policy_object_extended_community_profile_parcel_test.go b/internal/provider/data_source_sdwan_policy_object_extended_community_profile_parcel_test.go index ce9eee60..5734481e 100644 --- a/internal/provider/data_source_sdwan_policy_object_extended_community_profile_parcel_test.go +++ b/internal/provider/data_source_sdwan_policy_object_extended_community_profile_parcel_test.go @@ -29,8 +29,8 @@ import ( // Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSource func TestAccDataSourceSdwanPolicyObjectExtendedCommunityProfileParcel(t *testing.T) { - if os.Getenv("SDWAN_2012") == "" { - t.Skip("skipping test, set environment variable SDWAN_2012") + if os.Getenv("SDWAN_2012") == "" && os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") == "" { + t.Skip("skipping test, set environment variable SDWAN_2012 or POLICY_OBJECT_FEATURE_TEMPLATE_ID") } var checks []resource.TestCheckFunc checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_policy_object_extended_community_profile_parcel.test", "entries.0.extended_community", "soo 10.0.0.1:30")) @@ -39,7 +39,7 @@ func TestAccDataSourceSdwanPolicyObjectExtendedCommunityProfileParcel(t *testing ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, Steps: []resource.TestStep{ { - Config: testAccDataSourceSdwanPolicyObjectExtendedCommunityPrerequisitesProfileParcelConfig + testAccDataSourceSdwanPolicyObjectExtendedCommunityProfileParcelConfig(), + Config: testAccDataSourceSdwanPolicyObjectExtendedCommunityProfileParcelConfig(), Check: resource.ComposeTestCheckFunc(checks...), }, }, @@ -49,13 +49,6 @@ func TestAccDataSourceSdwanPolicyObjectExtendedCommunityProfileParcel(t *testing // End of section. //template:end testAccDataSource // Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites -const testAccDataSourceSdwanPolicyObjectExtendedCommunityPrerequisitesProfileParcelConfig = ` -resource "sdwan_policy_object_feature_profile" "test" { - name = "TF_TEST" - description = "Terraform test" -} -` - // End of section. //template:end testPrerequisites // Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSourceConfig @@ -63,7 +56,7 @@ func testAccDataSourceSdwanPolicyObjectExtendedCommunityProfileParcelConfig() st config := `resource "sdwan_policy_object_extended_community_profile_parcel" "test" {` + "\n" config += ` name = "TF_TEST"` + "\n" config += ` description = "Terraform integration test"` + "\n" - config += ` feature_profile_id = sdwan_policy_object_feature_profile.test.id` + "\n" + config += ` feature_profile_id = ` + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + `` + "\n" config += ` entries = [{` + "\n" config += ` extended_community = "soo 10.0.0.1:30"` + "\n" config += ` }]` + "\n" @@ -72,7 +65,7 @@ func testAccDataSourceSdwanPolicyObjectExtendedCommunityProfileParcelConfig() st config += ` data "sdwan_policy_object_extended_community_profile_parcel" "test" { id = sdwan_policy_object_extended_community_profile_parcel.test.id - feature_profile_id = sdwan_policy_object_feature_profile.test.id + feature_profile_id = ` + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + ` } ` return config diff --git a/internal/provider/data_source_sdwan_policy_object_ipv6_prefix_profile_parcel_test.go b/internal/provider/data_source_sdwan_policy_object_ipv6_prefix_profile_parcel_test.go index 6924db00..5e6efa47 100644 --- a/internal/provider/data_source_sdwan_policy_object_ipv6_prefix_profile_parcel_test.go +++ b/internal/provider/data_source_sdwan_policy_object_ipv6_prefix_profile_parcel_test.go @@ -29,8 +29,8 @@ import ( // Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSource func TestAccDataSourceSdwanPolicyObjectIPv6PrefixProfileParcel(t *testing.T) { - if os.Getenv("SDWAN_2012") == "" { - t.Skip("skipping test, set environment variable SDWAN_2012") + if os.Getenv("SDWAN_2012") == "" && os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") == "" { + t.Skip("skipping test, set environment variable SDWAN_2012 or POLICY_OBJECT_FEATURE_TEMPLATE_ID") } var checks []resource.TestCheckFunc checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_policy_object_ipv6_prefix_profile_parcel.test", "entries.0.ipv6_address", "2001:db8:85a3::8a2e:370:7334")) @@ -42,7 +42,7 @@ func TestAccDataSourceSdwanPolicyObjectIPv6PrefixProfileParcel(t *testing.T) { ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, Steps: []resource.TestStep{ { - Config: testAccDataSourceSdwanPolicyObjectIPv6PrefixPrerequisitesProfileParcelConfig + testAccDataSourceSdwanPolicyObjectIPv6PrefixProfileParcelConfig(), + Config: testAccDataSourceSdwanPolicyObjectIPv6PrefixProfileParcelConfig(), Check: resource.ComposeTestCheckFunc(checks...), }, }, @@ -52,13 +52,6 @@ func TestAccDataSourceSdwanPolicyObjectIPv6PrefixProfileParcel(t *testing.T) { // End of section. //template:end testAccDataSource // Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites -const testAccDataSourceSdwanPolicyObjectIPv6PrefixPrerequisitesProfileParcelConfig = ` -resource "sdwan_policy_object_feature_profile" "test" { - name = "TF_TEST" - description = "Terraform test" -} -` - // End of section. //template:end testPrerequisites // Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSourceConfig @@ -66,7 +59,7 @@ func testAccDataSourceSdwanPolicyObjectIPv6PrefixProfileParcelConfig() string { config := `resource "sdwan_policy_object_ipv6_prefix_profile_parcel" "test" {` + "\n" config += ` name = "TF_TEST"` + "\n" config += ` description = "Terraform integration test"` + "\n" - config += ` feature_profile_id = sdwan_policy_object_feature_profile.test.id` + "\n" + config += ` feature_profile_id = ` + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + `` + "\n" config += ` entries = [{` + "\n" config += ` ipv6_address = "2001:db8:85a3::8a2e:370:7334"` + "\n" config += ` ipv6_prefix_length = 64` + "\n" @@ -78,7 +71,7 @@ func testAccDataSourceSdwanPolicyObjectIPv6PrefixProfileParcelConfig() string { config += ` data "sdwan_policy_object_ipv6_prefix_profile_parcel" "test" { id = sdwan_policy_object_ipv6_prefix_profile_parcel.test.id - feature_profile_id = sdwan_policy_object_feature_profile.test.id + feature_profile_id = ` + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + ` } ` return config diff --git a/internal/provider/data_source_sdwan_policy_object_mirror_profile_parcel_test.go b/internal/provider/data_source_sdwan_policy_object_mirror_profile_parcel_test.go index b739b505..d6978482 100644 --- a/internal/provider/data_source_sdwan_policy_object_mirror_profile_parcel_test.go +++ b/internal/provider/data_source_sdwan_policy_object_mirror_profile_parcel_test.go @@ -29,8 +29,8 @@ import ( // Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSource func TestAccDataSourceSdwanPolicyObjectMirrorProfileParcel(t *testing.T) { - if os.Getenv("SDWAN_2012") == "" { - t.Skip("skipping test, set environment variable SDWAN_2012") + if os.Getenv("SDWAN_2012") == "" && os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") == "" { + t.Skip("skipping test, set environment variable SDWAN_2012 or POLICY_OBJECT_FEATURE_TEMPLATE_ID") } var checks []resource.TestCheckFunc checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_policy_object_mirror_profile_parcel.test", "entries.0.remote_destination_ip", "10.0.0.1")) @@ -40,7 +40,7 @@ func TestAccDataSourceSdwanPolicyObjectMirrorProfileParcel(t *testing.T) { ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, Steps: []resource.TestStep{ { - Config: testAccDataSourceSdwanPolicyObjectMirrorPrerequisitesProfileParcelConfig + testAccDataSourceSdwanPolicyObjectMirrorProfileParcelConfig(), + Config: testAccDataSourceSdwanPolicyObjectMirrorProfileParcelConfig(), Check: resource.ComposeTestCheckFunc(checks...), }, }, @@ -50,13 +50,6 @@ func TestAccDataSourceSdwanPolicyObjectMirrorProfileParcel(t *testing.T) { // End of section. //template:end testAccDataSource // Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites -const testAccDataSourceSdwanPolicyObjectMirrorPrerequisitesProfileParcelConfig = ` -resource "sdwan_policy_object_feature_profile" "test" { - name = "TF_TEST" - description = "Terraform test" -} -` - // End of section. //template:end testPrerequisites // Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSourceConfig @@ -64,7 +57,7 @@ func testAccDataSourceSdwanPolicyObjectMirrorProfileParcelConfig() string { config := `resource "sdwan_policy_object_mirror_profile_parcel" "test" {` + "\n" config += ` name = "TF_TEST"` + "\n" config += ` description = "Terraform integration test"` + "\n" - config += ` feature_profile_id = sdwan_policy_object_feature_profile.test.id` + "\n" + config += ` feature_profile_id = ` + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + `` + "\n" config += ` entries = [{` + "\n" config += ` remote_destination_ip = "10.0.0.1"` + "\n" config += ` source_ip = "10.0.0.2"` + "\n" @@ -74,7 +67,7 @@ func testAccDataSourceSdwanPolicyObjectMirrorProfileParcelConfig() string { config += ` data "sdwan_policy_object_mirror_profile_parcel" "test" { id = sdwan_policy_object_mirror_profile_parcel.test.id - feature_profile_id = sdwan_policy_object_feature_profile.test.id + feature_profile_id = ` + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + ` } ` return config diff --git a/internal/provider/data_source_sdwan_policy_object_policer_profile_parcel_test.go b/internal/provider/data_source_sdwan_policy_object_policer_profile_parcel_test.go index a19c05da..159ccfad 100644 --- a/internal/provider/data_source_sdwan_policy_object_policer_profile_parcel_test.go +++ b/internal/provider/data_source_sdwan_policy_object_policer_profile_parcel_test.go @@ -29,8 +29,8 @@ import ( // Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSource func TestAccDataSourceSdwanPolicyObjectPolicerProfileParcel(t *testing.T) { - if os.Getenv("SDWAN_2012") == "" { - t.Skip("skipping test, set environment variable SDWAN_2012") + if os.Getenv("SDWAN_2012") == "" && os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") == "" { + t.Skip("skipping test, set environment variable SDWAN_2012 or POLICY_OBJECT_FEATURE_TEMPLATE_ID") } var checks []resource.TestCheckFunc checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_policy_object_policer_profile_parcel.test", "entries.0.burst_bytes", "56500")) @@ -41,7 +41,7 @@ func TestAccDataSourceSdwanPolicyObjectPolicerProfileParcel(t *testing.T) { ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, Steps: []resource.TestStep{ { - Config: testAccDataSourceSdwanPolicyObjectPolicerPrerequisitesProfileParcelConfig + testAccDataSourceSdwanPolicyObjectPolicerProfileParcelConfig(), + Config: testAccDataSourceSdwanPolicyObjectPolicerProfileParcelConfig(), Check: resource.ComposeTestCheckFunc(checks...), }, }, @@ -51,13 +51,6 @@ func TestAccDataSourceSdwanPolicyObjectPolicerProfileParcel(t *testing.T) { // End of section. //template:end testAccDataSource // Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites -const testAccDataSourceSdwanPolicyObjectPolicerPrerequisitesProfileParcelConfig = ` -resource "sdwan_policy_object_feature_profile" "test" { - name = "TF_TEST" - description = "Terraform test" -} -` - // End of section. //template:end testPrerequisites // Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSourceConfig @@ -65,7 +58,7 @@ func testAccDataSourceSdwanPolicyObjectPolicerProfileParcelConfig() string { config := `resource "sdwan_policy_object_policer_profile_parcel" "test" {` + "\n" config += ` name = "TF_TEST"` + "\n" config += ` description = "Terraform integration test"` + "\n" - config += ` feature_profile_id = sdwan_policy_object_feature_profile.test.id` + "\n" + config += ` feature_profile_id = ` + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + `` + "\n" config += ` entries = [{` + "\n" config += ` burst_bytes = 56500` + "\n" config += ` select_value = "remark"` + "\n" @@ -76,7 +69,7 @@ func testAccDataSourceSdwanPolicyObjectPolicerProfileParcelConfig() string { config += ` data "sdwan_policy_object_policer_profile_parcel" "test" { id = sdwan_policy_object_policer_profile_parcel.test.id - feature_profile_id = sdwan_policy_object_feature_profile.test.id + feature_profile_id = ` + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + ` } ` return config diff --git a/internal/provider/data_source_sdwan_policy_object_prefix_profile_parcel_test.go b/internal/provider/data_source_sdwan_policy_object_prefix_profile_parcel_test.go index 3620a175..985cb392 100644 --- a/internal/provider/data_source_sdwan_policy_object_prefix_profile_parcel_test.go +++ b/internal/provider/data_source_sdwan_policy_object_prefix_profile_parcel_test.go @@ -29,8 +29,8 @@ import ( // Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSource func TestAccDataSourceSdwanPolicyObjectPrefixProfileParcel(t *testing.T) { - if os.Getenv("SDWAN_2012") == "" { - t.Skip("skipping test, set environment variable SDWAN_2012") + if os.Getenv("SDWAN_2012") == "" && os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") == "" { + t.Skip("skipping test, set environment variable SDWAN_2012 or POLICY_OBJECT_FEATURE_TEMPLATE_ID") } var checks []resource.TestCheckFunc checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_policy_object_prefix_profile_parcel.test", "entries.0.ipv4_address", "10.0.0.0")) @@ -42,7 +42,7 @@ func TestAccDataSourceSdwanPolicyObjectPrefixProfileParcel(t *testing.T) { ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, Steps: []resource.TestStep{ { - Config: testAccDataSourceSdwanPolicyObjectPrefixPrerequisitesProfileParcelConfig + testAccDataSourceSdwanPolicyObjectPrefixProfileParcelConfig(), + Config: testAccDataSourceSdwanPolicyObjectPrefixProfileParcelConfig(), Check: resource.ComposeTestCheckFunc(checks...), }, }, @@ -52,13 +52,6 @@ func TestAccDataSourceSdwanPolicyObjectPrefixProfileParcel(t *testing.T) { // End of section. //template:end testAccDataSource // Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites -const testAccDataSourceSdwanPolicyObjectPrefixPrerequisitesProfileParcelConfig = ` -resource "sdwan_policy_object_feature_profile" "test" { - name = "TF_TEST" - description = "Terraform test" -} -` - // End of section. //template:end testPrerequisites // Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSourceConfig @@ -66,7 +59,7 @@ func testAccDataSourceSdwanPolicyObjectPrefixProfileParcelConfig() string { config := `resource "sdwan_policy_object_prefix_profile_parcel" "test" {` + "\n" config += ` name = "TF_TEST"` + "\n" config += ` description = "Terraform integration test"` + "\n" - config += ` feature_profile_id = sdwan_policy_object_feature_profile.test.id` + "\n" + config += ` feature_profile_id = ` + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + `` + "\n" config += ` entries = [{` + "\n" config += ` ipv4_address = "10.0.0.0"` + "\n" config += ` ipv4_prefix_length = 8` + "\n" @@ -78,7 +71,7 @@ func testAccDataSourceSdwanPolicyObjectPrefixProfileParcelConfig() string { config += ` data "sdwan_policy_object_prefix_profile_parcel" "test" { id = sdwan_policy_object_prefix_profile_parcel.test.id - feature_profile_id = sdwan_policy_object_feature_profile.test.id + feature_profile_id = ` + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + ` } ` return config diff --git a/internal/provider/data_source_sdwan_policy_object_tloc_profile_parcel_test.go b/internal/provider/data_source_sdwan_policy_object_tloc_profile_parcel_test.go index e62bad02..d9bf442c 100644 --- a/internal/provider/data_source_sdwan_policy_object_tloc_profile_parcel_test.go +++ b/internal/provider/data_source_sdwan_policy_object_tloc_profile_parcel_test.go @@ -29,8 +29,8 @@ import ( // Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSource func TestAccDataSourceSdwanPolicyObjectTLOCProfileParcel(t *testing.T) { - if os.Getenv("SDWAN_2012") == "" { - t.Skip("skipping test, set environment variable SDWAN_2012") + if os.Getenv("SDWAN_2012") == "" && os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") == "" { + t.Skip("skipping test, set environment variable SDWAN_2012 or POLICY_OBJECT_FEATURE_TEMPLATE_ID") } var checks []resource.TestCheckFunc checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_policy_object_tloc_profile_parcel.test", "entries.0.tloc", "10.0.0.0")) @@ -42,7 +42,7 @@ func TestAccDataSourceSdwanPolicyObjectTLOCProfileParcel(t *testing.T) { ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, Steps: []resource.TestStep{ { - Config: testAccDataSourceSdwanPolicyObjectTLOCPrerequisitesProfileParcelConfig + testAccDataSourceSdwanPolicyObjectTLOCProfileParcelConfig(), + Config: testAccDataSourceSdwanPolicyObjectTLOCProfileParcelConfig(), Check: resource.ComposeTestCheckFunc(checks...), }, }, @@ -52,13 +52,6 @@ func TestAccDataSourceSdwanPolicyObjectTLOCProfileParcel(t *testing.T) { // End of section. //template:end testAccDataSource // Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites -const testAccDataSourceSdwanPolicyObjectTLOCPrerequisitesProfileParcelConfig = ` -resource "sdwan_policy_object_feature_profile" "test" { - name = "TF_TEST" - description = "Terraform test" -} -` - // End of section. //template:end testPrerequisites // Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSourceConfig @@ -66,7 +59,7 @@ func testAccDataSourceSdwanPolicyObjectTLOCProfileParcelConfig() string { config := `resource "sdwan_policy_object_tloc_profile_parcel" "test" {` + "\n" config += ` name = "TF_TEST"` + "\n" config += ` description = "Terraform integration test"` + "\n" - config += ` feature_profile_id = sdwan_policy_object_feature_profile.test.id` + "\n" + config += ` feature_profile_id = ` + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + `` + "\n" config += ` entries = [{` + "\n" config += ` tloc = "10.0.0.0"` + "\n" config += ` color = "3g"` + "\n" @@ -78,7 +71,7 @@ func testAccDataSourceSdwanPolicyObjectTLOCProfileParcelConfig() string { config += ` data "sdwan_policy_object_tloc_profile_parcel" "test" { id = sdwan_policy_object_tloc_profile_parcel.test.id - feature_profile_id = sdwan_policy_object_feature_profile.test.id + feature_profile_id = ` + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + ` } ` return config diff --git a/internal/provider/resource_sdwan_policy_object_class_map_profile_parcel_test.go b/internal/provider/resource_sdwan_policy_object_class_map_profile_parcel_test.go index c3d545ca..f356d26f 100644 --- a/internal/provider/resource_sdwan_policy_object_class_map_profile_parcel_test.go +++ b/internal/provider/resource_sdwan_policy_object_class_map_profile_parcel_test.go @@ -29,8 +29,8 @@ import ( // Section below is generated&owned by "gen/generator.go". //template:begin testAcc func TestAccSdwanPolicyObjectClassMapProfileParcel(t *testing.T) { - if os.Getenv("SDWAN_2012") == "" { - t.Skip("skipping test, set environment variable SDWAN_2012") + if os.Getenv("SDWAN_2012") == "" && os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") == "" { + t.Skip("skipping test, set environment variable SDWAN_2012 or POLICY_OBJECT_FEATURE_TEMPLATE_ID") } var checks []resource.TestCheckFunc checks = append(checks, resource.TestCheckResourceAttr("sdwan_policy_object_class_map_profile_parcel.test", "entries.0.queue", "0")) @@ -39,10 +39,10 @@ func TestAccSdwanPolicyObjectClassMapProfileParcel(t *testing.T) { ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, Steps: []resource.TestStep{ { - Config: testAccSdwanPolicyObjectClassMapPrerequisitesProfileParcelConfig + testAccSdwanPolicyObjectClassMapProfileParcelConfig_minimum(), + Config: testAccSdwanPolicyObjectClassMapProfileParcelConfig_minimum(), }, { - Config: testAccSdwanPolicyObjectClassMapPrerequisitesProfileParcelConfig + testAccSdwanPolicyObjectClassMapProfileParcelConfig_all(), + Config: testAccSdwanPolicyObjectClassMapProfileParcelConfig_all(), Check: resource.ComposeTestCheckFunc(checks...), }, }, @@ -52,13 +52,6 @@ func TestAccSdwanPolicyObjectClassMapProfileParcel(t *testing.T) { // End of section. //template:end testAcc // Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites -const testAccSdwanPolicyObjectClassMapPrerequisitesProfileParcelConfig = ` -resource "sdwan_policy_object_feature_profile" "test" { - name = "TF_TEST" - description = "Terraform test" -} -` - // End of section. //template:end testPrerequisites // Section below is generated&owned by "gen/generator.go". //template:begin testAccConfigMinimum @@ -66,7 +59,7 @@ func testAccSdwanPolicyObjectClassMapProfileParcelConfig_minimum() string { config := `resource "sdwan_policy_object_class_map_profile_parcel" "test" {` + "\n" config += ` name = "TF_TEST_MIN"` + "\n" config += ` description = "Terraform integration test"` + "\n" - config += ` feature_profile_id = sdwan_policy_object_feature_profile.test.id` + "\n" + config += ` feature_profile_id = ` + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + `` + "\n" config += ` entries = [{` + "\n" config += ` queue = 0` + "\n" config += ` }]` + "\n" @@ -81,7 +74,7 @@ func testAccSdwanPolicyObjectClassMapProfileParcelConfig_all() string { config := `resource "sdwan_policy_object_class_map_profile_parcel" "test" {` + "\n" config += ` name = "TF_TEST_ALL"` + "\n" config += ` description = "Terraform integration test"` + "\n" - config += ` feature_profile_id = sdwan_policy_object_feature_profile.test.id` + "\n" + config += ` feature_profile_id = ` + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + `` + "\n" config += ` entries = [{` + "\n" config += ` queue = "0"` + "\n" config += ` }]` + "\n" diff --git a/internal/provider/resource_sdwan_policy_object_color_profile_parcel_test.go b/internal/provider/resource_sdwan_policy_object_color_profile_parcel_test.go index ec54121c..5aebff59 100644 --- a/internal/provider/resource_sdwan_policy_object_color_profile_parcel_test.go +++ b/internal/provider/resource_sdwan_policy_object_color_profile_parcel_test.go @@ -29,8 +29,8 @@ import ( // Section below is generated&owned by "gen/generator.go". //template:begin testAcc func TestAccSdwanPolicyObjectColorProfileParcel(t *testing.T) { - if os.Getenv("SDWAN_2012") == "" { - t.Skip("skipping test, set environment variable SDWAN_2012") + if os.Getenv("SDWAN_2012") == "" && os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") == "" { + t.Skip("skipping test, set environment variable SDWAN_2012 or POLICY_OBJECT_FEATURE_TEMPLATE_ID") } var checks []resource.TestCheckFunc checks = append(checks, resource.TestCheckResourceAttr("sdwan_policy_object_color_profile_parcel.test", "entries.0.color", "blue")) @@ -39,10 +39,10 @@ func TestAccSdwanPolicyObjectColorProfileParcel(t *testing.T) { ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, Steps: []resource.TestStep{ { - Config: testAccSdwanPolicyObjectColorPrerequisitesProfileParcelConfig + testAccSdwanPolicyObjectColorProfileParcelConfig_minimum(), + Config: testAccSdwanPolicyObjectColorProfileParcelConfig_minimum(), }, { - Config: testAccSdwanPolicyObjectColorPrerequisitesProfileParcelConfig + testAccSdwanPolicyObjectColorProfileParcelConfig_all(), + Config: testAccSdwanPolicyObjectColorProfileParcelConfig_all(), Check: resource.ComposeTestCheckFunc(checks...), }, }, @@ -52,13 +52,6 @@ func TestAccSdwanPolicyObjectColorProfileParcel(t *testing.T) { // End of section. //template:end testAcc // Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites -const testAccSdwanPolicyObjectColorPrerequisitesProfileParcelConfig = ` -resource "sdwan_policy_object_feature_profile" "test" { - name = "TF_TEST" - description = "Terraform test" -} -` - // End of section. //template:end testPrerequisites // Section below is generated&owned by "gen/generator.go". //template:begin testAccConfigMinimum @@ -66,7 +59,7 @@ func testAccSdwanPolicyObjectColorProfileParcelConfig_minimum() string { config := `resource "sdwan_policy_object_color_profile_parcel" "test" {` + "\n" config += ` name = "TF_TEST_MIN"` + "\n" config += ` description = "Terraform integration test"` + "\n" - config += ` feature_profile_id = sdwan_policy_object_feature_profile.test.id` + "\n" + config += ` feature_profile_id = ` + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + `` + "\n" config += ` entries = [{` + "\n" config += ` color = "blue"` + "\n" config += ` }]` + "\n" @@ -81,7 +74,7 @@ func testAccSdwanPolicyObjectColorProfileParcelConfig_all() string { config := `resource "sdwan_policy_object_color_profile_parcel" "test" {` + "\n" config += ` name = "TF_TEST_ALL"` + "\n" config += ` description = "Terraform integration test"` + "\n" - config += ` feature_profile_id = sdwan_policy_object_feature_profile.test.id` + "\n" + config += ` feature_profile_id = ` + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + `` + "\n" config += ` entries = [{` + "\n" config += ` color = "blue"` + "\n" config += ` }]` + "\n" diff --git a/internal/provider/resource_sdwan_policy_object_data_ipv6_prefix_profile_parcel_test.go b/internal/provider/resource_sdwan_policy_object_data_ipv6_prefix_profile_parcel_test.go index 25eac47f..5ecb715d 100644 --- a/internal/provider/resource_sdwan_policy_object_data_ipv6_prefix_profile_parcel_test.go +++ b/internal/provider/resource_sdwan_policy_object_data_ipv6_prefix_profile_parcel_test.go @@ -29,8 +29,8 @@ import ( // Section below is generated&owned by "gen/generator.go". //template:begin testAcc func TestAccSdwanPolicyObjectDataIPv6PrefixProfileParcel(t *testing.T) { - if os.Getenv("SDWAN_2012") == "" { - t.Skip("skipping test, set environment variable SDWAN_2012") + if os.Getenv("SDWAN_2012") == "" && os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") == "" { + t.Skip("skipping test, set environment variable SDWAN_2012 or POLICY_OBJECT_FEATURE_TEMPLATE_ID") } var checks []resource.TestCheckFunc checks = append(checks, resource.TestCheckResourceAttr("sdwan_policy_object_data_ipv6_prefix_profile_parcel.test", "entries.0.ipv6_address", "2001:db8:85a3::8a2e:370:7334")) @@ -40,10 +40,10 @@ func TestAccSdwanPolicyObjectDataIPv6PrefixProfileParcel(t *testing.T) { ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, Steps: []resource.TestStep{ { - Config: testAccSdwanPolicyObjectDataIPv6PrefixPrerequisitesProfileParcelConfig + testAccSdwanPolicyObjectDataIPv6PrefixProfileParcelConfig_minimum(), + Config: testAccSdwanPolicyObjectDataIPv6PrefixProfileParcelConfig_minimum(), }, { - Config: testAccSdwanPolicyObjectDataIPv6PrefixPrerequisitesProfileParcelConfig + testAccSdwanPolicyObjectDataIPv6PrefixProfileParcelConfig_all(), + Config: testAccSdwanPolicyObjectDataIPv6PrefixProfileParcelConfig_all(), Check: resource.ComposeTestCheckFunc(checks...), }, }, @@ -53,13 +53,6 @@ func TestAccSdwanPolicyObjectDataIPv6PrefixProfileParcel(t *testing.T) { // End of section. //template:end testAcc // Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites -const testAccSdwanPolicyObjectDataIPv6PrefixPrerequisitesProfileParcelConfig = ` -resource "sdwan_policy_object_feature_profile" "test" { - name = "TF_TEST" - description = "Terraform test" -} -` - // End of section. //template:end testPrerequisites // Section below is generated&owned by "gen/generator.go". //template:begin testAccConfigMinimum @@ -67,7 +60,7 @@ func testAccSdwanPolicyObjectDataIPv6PrefixProfileParcelConfig_minimum() string config := `resource "sdwan_policy_object_data_ipv6_prefix_profile_parcel" "test" {` + "\n" config += ` name = "TF_TEST_MIN"` + "\n" config += ` description = "Terraform integration test"` + "\n" - config += ` feature_profile_id = sdwan_policy_object_feature_profile.test.id` + "\n" + config += ` feature_profile_id = ` + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + `` + "\n" config += ` entries = [{` + "\n" config += ` ipv6_address = "2001:db8:85a3::8a2e:370:7334"` + "\n" config += ` ipv6_prefix_length = 64` + "\n" @@ -83,7 +76,7 @@ func testAccSdwanPolicyObjectDataIPv6PrefixProfileParcelConfig_all() string { config := `resource "sdwan_policy_object_data_ipv6_prefix_profile_parcel" "test" {` + "\n" config += ` name = "TF_TEST_ALL"` + "\n" config += ` description = "Terraform integration test"` + "\n" - config += ` feature_profile_id = sdwan_policy_object_feature_profile.test.id` + "\n" + config += ` feature_profile_id = ` + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + `` + "\n" config += ` entries = [{` + "\n" config += ` ipv6_address = "2001:db8:85a3::8a2e:370:7334"` + "\n" config += ` ipv6_prefix_length = 64` + "\n" diff --git a/internal/provider/resource_sdwan_policy_object_data_prefix_profile_parcel_test.go b/internal/provider/resource_sdwan_policy_object_data_prefix_profile_parcel_test.go index e5ae6553..3c5ac62b 100644 --- a/internal/provider/resource_sdwan_policy_object_data_prefix_profile_parcel_test.go +++ b/internal/provider/resource_sdwan_policy_object_data_prefix_profile_parcel_test.go @@ -29,8 +29,8 @@ import ( // Section below is generated&owned by "gen/generator.go". //template:begin testAcc func TestAccSdwanPolicyObjectDataPrefixProfileParcel(t *testing.T) { - if os.Getenv("SDWAN_2012") == "" { - t.Skip("skipping test, set environment variable SDWAN_2012") + if os.Getenv("SDWAN_2012") == "" && os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") == "" { + t.Skip("skipping test, set environment variable SDWAN_2012 or POLICY_OBJECT_FEATURE_TEMPLATE_ID") } var checks []resource.TestCheckFunc checks = append(checks, resource.TestCheckResourceAttr("sdwan_policy_object_data_prefix_profile_parcel.test", "entries.0.ipv4_address", "10.0.0.0")) @@ -40,10 +40,10 @@ func TestAccSdwanPolicyObjectDataPrefixProfileParcel(t *testing.T) { ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, Steps: []resource.TestStep{ { - Config: testAccSdwanPolicyObjectDataPrefixPrerequisitesProfileParcelConfig + testAccSdwanPolicyObjectDataPrefixProfileParcelConfig_minimum(), + Config: testAccSdwanPolicyObjectDataPrefixProfileParcelConfig_minimum(), }, { - Config: testAccSdwanPolicyObjectDataPrefixPrerequisitesProfileParcelConfig + testAccSdwanPolicyObjectDataPrefixProfileParcelConfig_all(), + Config: testAccSdwanPolicyObjectDataPrefixProfileParcelConfig_all(), Check: resource.ComposeTestCheckFunc(checks...), }, }, @@ -53,13 +53,6 @@ func TestAccSdwanPolicyObjectDataPrefixProfileParcel(t *testing.T) { // End of section. //template:end testAcc // Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites -const testAccSdwanPolicyObjectDataPrefixPrerequisitesProfileParcelConfig = ` -resource "sdwan_policy_object_feature_profile" "test" { - name = "TF_TEST" - description = "Terraform test" -} -` - // End of section. //template:end testPrerequisites // Section below is generated&owned by "gen/generator.go". //template:begin testAccConfigMinimum @@ -67,7 +60,7 @@ func testAccSdwanPolicyObjectDataPrefixProfileParcelConfig_minimum() string { config := `resource "sdwan_policy_object_data_prefix_profile_parcel" "test" {` + "\n" config += ` name = "TF_TEST_MIN"` + "\n" config += ` description = "Terraform integration test"` + "\n" - config += ` feature_profile_id = sdwan_policy_object_feature_profile.test.id` + "\n" + config += ` feature_profile_id = ` + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + `` + "\n" config += ` entries = [{` + "\n" config += ` ipv4_address = "10.0.0.0"` + "\n" config += ` ipv4_prefix_length = 8` + "\n" @@ -83,7 +76,7 @@ func testAccSdwanPolicyObjectDataPrefixProfileParcelConfig_all() string { config := `resource "sdwan_policy_object_data_prefix_profile_parcel" "test" {` + "\n" config += ` name = "TF_TEST_ALL"` + "\n" config += ` description = "Terraform integration test"` + "\n" - config += ` feature_profile_id = sdwan_policy_object_feature_profile.test.id` + "\n" + config += ` feature_profile_id = ` + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + `` + "\n" config += ` entries = [{` + "\n" config += ` ipv4_address = "10.0.0.0"` + "\n" config += ` ipv4_prefix_length = 8` + "\n" diff --git a/internal/provider/resource_sdwan_policy_object_expanded_community_profile_parcel_test.go b/internal/provider/resource_sdwan_policy_object_expanded_community_profile_parcel_test.go index 66d34efa..d3f3d353 100644 --- a/internal/provider/resource_sdwan_policy_object_expanded_community_profile_parcel_test.go +++ b/internal/provider/resource_sdwan_policy_object_expanded_community_profile_parcel_test.go @@ -29,8 +29,8 @@ import ( // Section below is generated&owned by "gen/generator.go". //template:begin testAcc func TestAccSdwanPolicyObjectExpandedCommunityProfileParcel(t *testing.T) { - if os.Getenv("SDWAN_2012") == "" { - t.Skip("skipping test, set environment variable SDWAN_2012") + if os.Getenv("SDWAN_2012") == "" && os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") == "" { + t.Skip("skipping test, set environment variable SDWAN_2012 or POLICY_OBJECT_FEATURE_TEMPLATE_ID") } var checks []resource.TestCheckFunc resource.Test(t, resource.TestCase{ @@ -38,10 +38,10 @@ func TestAccSdwanPolicyObjectExpandedCommunityProfileParcel(t *testing.T) { ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, Steps: []resource.TestStep{ { - Config: testAccSdwanPolicyObjectExpandedCommunityPrerequisitesProfileParcelConfig + testAccSdwanPolicyObjectExpandedCommunityProfileParcelConfig_minimum(), + Config: testAccSdwanPolicyObjectExpandedCommunityProfileParcelConfig_minimum(), }, { - Config: testAccSdwanPolicyObjectExpandedCommunityPrerequisitesProfileParcelConfig + testAccSdwanPolicyObjectExpandedCommunityProfileParcelConfig_all(), + Config: testAccSdwanPolicyObjectExpandedCommunityProfileParcelConfig_all(), Check: resource.ComposeTestCheckFunc(checks...), }, }, @@ -51,13 +51,6 @@ func TestAccSdwanPolicyObjectExpandedCommunityProfileParcel(t *testing.T) { // End of section. //template:end testAcc // Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites -const testAccSdwanPolicyObjectExpandedCommunityPrerequisitesProfileParcelConfig = ` -resource "sdwan_policy_object_feature_profile" "test" { - name = "TF_TEST" - description = "Terraform test" -} -` - // End of section. //template:end testPrerequisites // Section below is generated&owned by "gen/generator.go". //template:begin testAccConfigMinimum @@ -65,7 +58,7 @@ func testAccSdwanPolicyObjectExpandedCommunityProfileParcelConfig_minimum() stri config := `resource "sdwan_policy_object_expanded_community_profile_parcel" "test" {` + "\n" config += ` name = "TF_TEST_MIN"` + "\n" config += ` description = "Terraform integration test"` + "\n" - config += ` feature_profile_id = sdwan_policy_object_feature_profile.test.id` + "\n" + config += ` feature_profile_id = ` + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + `` + "\n" config += ` expanded_community_lists = ["abcd"]` + "\n" config += `}` + "\n" return config @@ -78,7 +71,7 @@ func testAccSdwanPolicyObjectExpandedCommunityProfileParcelConfig_all() string { config := `resource "sdwan_policy_object_expanded_community_profile_parcel" "test" {` + "\n" config += ` name = "TF_TEST_ALL"` + "\n" config += ` description = "Terraform integration test"` + "\n" - config += ` feature_profile_id = sdwan_policy_object_feature_profile.test.id` + "\n" + config += ` feature_profile_id = ` + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + `` + "\n" config += ` expanded_community_lists = ["abcd"]` + "\n" config += `}` + "\n" return config diff --git a/internal/provider/resource_sdwan_policy_object_extended_community_profile_parcel_test.go b/internal/provider/resource_sdwan_policy_object_extended_community_profile_parcel_test.go index 2e639146..cc28d3bd 100644 --- a/internal/provider/resource_sdwan_policy_object_extended_community_profile_parcel_test.go +++ b/internal/provider/resource_sdwan_policy_object_extended_community_profile_parcel_test.go @@ -29,8 +29,8 @@ import ( // Section below is generated&owned by "gen/generator.go". //template:begin testAcc func TestAccSdwanPolicyObjectExtendedCommunityProfileParcel(t *testing.T) { - if os.Getenv("SDWAN_2012") == "" { - t.Skip("skipping test, set environment variable SDWAN_2012") + if os.Getenv("SDWAN_2012") == "" && os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") == "" { + t.Skip("skipping test, set environment variable SDWAN_2012 or POLICY_OBJECT_FEATURE_TEMPLATE_ID") } var checks []resource.TestCheckFunc checks = append(checks, resource.TestCheckResourceAttr("sdwan_policy_object_extended_community_profile_parcel.test", "entries.0.extended_community", "soo 10.0.0.1:30")) @@ -39,10 +39,10 @@ func TestAccSdwanPolicyObjectExtendedCommunityProfileParcel(t *testing.T) { ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, Steps: []resource.TestStep{ { - Config: testAccSdwanPolicyObjectExtendedCommunityPrerequisitesProfileParcelConfig + testAccSdwanPolicyObjectExtendedCommunityProfileParcelConfig_minimum(), + Config: testAccSdwanPolicyObjectExtendedCommunityProfileParcelConfig_minimum(), }, { - Config: testAccSdwanPolicyObjectExtendedCommunityPrerequisitesProfileParcelConfig + testAccSdwanPolicyObjectExtendedCommunityProfileParcelConfig_all(), + Config: testAccSdwanPolicyObjectExtendedCommunityProfileParcelConfig_all(), Check: resource.ComposeTestCheckFunc(checks...), }, }, @@ -52,13 +52,6 @@ func TestAccSdwanPolicyObjectExtendedCommunityProfileParcel(t *testing.T) { // End of section. //template:end testAcc // Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites -const testAccSdwanPolicyObjectExtendedCommunityPrerequisitesProfileParcelConfig = ` -resource "sdwan_policy_object_feature_profile" "test" { - name = "TF_TEST" - description = "Terraform test" -} -` - // End of section. //template:end testPrerequisites // Section below is generated&owned by "gen/generator.go". //template:begin testAccConfigMinimum @@ -66,7 +59,7 @@ func testAccSdwanPolicyObjectExtendedCommunityProfileParcelConfig_minimum() stri config := `resource "sdwan_policy_object_extended_community_profile_parcel" "test" {` + "\n" config += ` name = "TF_TEST_MIN"` + "\n" config += ` description = "Terraform integration test"` + "\n" - config += ` feature_profile_id = sdwan_policy_object_feature_profile.test.id` + "\n" + config += ` feature_profile_id = ` + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + `` + "\n" config += ` entries = [{` + "\n" config += ` extended_community = "soo 10.0.0.1:30"` + "\n" config += ` }]` + "\n" @@ -81,7 +74,7 @@ func testAccSdwanPolicyObjectExtendedCommunityProfileParcelConfig_all() string { config := `resource "sdwan_policy_object_extended_community_profile_parcel" "test" {` + "\n" config += ` name = "TF_TEST_ALL"` + "\n" config += ` description = "Terraform integration test"` + "\n" - config += ` feature_profile_id = sdwan_policy_object_feature_profile.test.id` + "\n" + config += ` feature_profile_id = ` + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + `` + "\n" config += ` entries = [{` + "\n" config += ` extended_community = "soo 10.0.0.1:30"` + "\n" config += ` }]` + "\n" diff --git a/internal/provider/resource_sdwan_policy_object_ipv6_prefix_profile_parcel_test.go b/internal/provider/resource_sdwan_policy_object_ipv6_prefix_profile_parcel_test.go index 798edbfb..a599081a 100644 --- a/internal/provider/resource_sdwan_policy_object_ipv6_prefix_profile_parcel_test.go +++ b/internal/provider/resource_sdwan_policy_object_ipv6_prefix_profile_parcel_test.go @@ -29,8 +29,8 @@ import ( // Section below is generated&owned by "gen/generator.go". //template:begin testAcc func TestAccSdwanPolicyObjectIPv6PrefixProfileParcel(t *testing.T) { - if os.Getenv("SDWAN_2012") == "" { - t.Skip("skipping test, set environment variable SDWAN_2012") + if os.Getenv("SDWAN_2012") == "" && os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") == "" { + t.Skip("skipping test, set environment variable SDWAN_2012 or POLICY_OBJECT_FEATURE_TEMPLATE_ID") } var checks []resource.TestCheckFunc checks = append(checks, resource.TestCheckResourceAttr("sdwan_policy_object_ipv6_prefix_profile_parcel.test", "entries.0.ipv6_address", "2001:db8:85a3::8a2e:370:7334")) @@ -42,10 +42,10 @@ func TestAccSdwanPolicyObjectIPv6PrefixProfileParcel(t *testing.T) { ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, Steps: []resource.TestStep{ { - Config: testAccSdwanPolicyObjectIPv6PrefixPrerequisitesProfileParcelConfig + testAccSdwanPolicyObjectIPv6PrefixProfileParcelConfig_minimum(), + Config: testAccSdwanPolicyObjectIPv6PrefixProfileParcelConfig_minimum(), }, { - Config: testAccSdwanPolicyObjectIPv6PrefixPrerequisitesProfileParcelConfig + testAccSdwanPolicyObjectIPv6PrefixProfileParcelConfig_all(), + Config: testAccSdwanPolicyObjectIPv6PrefixProfileParcelConfig_all(), Check: resource.ComposeTestCheckFunc(checks...), }, }, @@ -55,13 +55,6 @@ func TestAccSdwanPolicyObjectIPv6PrefixProfileParcel(t *testing.T) { // End of section. //template:end testAcc // Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites -const testAccSdwanPolicyObjectIPv6PrefixPrerequisitesProfileParcelConfig = ` -resource "sdwan_policy_object_feature_profile" "test" { - name = "TF_TEST" - description = "Terraform test" -} -` - // End of section. //template:end testPrerequisites // Section below is generated&owned by "gen/generator.go". //template:begin testAccConfigMinimum @@ -69,7 +62,7 @@ func testAccSdwanPolicyObjectIPv6PrefixProfileParcelConfig_minimum() string { config := `resource "sdwan_policy_object_ipv6_prefix_profile_parcel" "test" {` + "\n" config += ` name = "TF_TEST_MIN"` + "\n" config += ` description = "Terraform integration test"` + "\n" - config += ` feature_profile_id = sdwan_policy_object_feature_profile.test.id` + "\n" + config += ` feature_profile_id = ` + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + `` + "\n" config += ` entries = [{` + "\n" config += ` ipv6_address = "2001:db8:85a3::8a2e:370:7334"` + "\n" config += ` ipv6_prefix_length = 64` + "\n" @@ -87,7 +80,7 @@ func testAccSdwanPolicyObjectIPv6PrefixProfileParcelConfig_all() string { config := `resource "sdwan_policy_object_ipv6_prefix_profile_parcel" "test" {` + "\n" config += ` name = "TF_TEST_ALL"` + "\n" config += ` description = "Terraform integration test"` + "\n" - config += ` feature_profile_id = sdwan_policy_object_feature_profile.test.id` + "\n" + config += ` feature_profile_id = ` + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + `` + "\n" config += ` entries = [{` + "\n" config += ` ipv6_address = "2001:db8:85a3::8a2e:370:7334"` + "\n" config += ` ipv6_prefix_length = 64` + "\n" diff --git a/internal/provider/resource_sdwan_policy_object_mirror_profile_parcel_test.go b/internal/provider/resource_sdwan_policy_object_mirror_profile_parcel_test.go index 157a18d1..51801ceb 100644 --- a/internal/provider/resource_sdwan_policy_object_mirror_profile_parcel_test.go +++ b/internal/provider/resource_sdwan_policy_object_mirror_profile_parcel_test.go @@ -29,8 +29,8 @@ import ( // Section below is generated&owned by "gen/generator.go". //template:begin testAcc func TestAccSdwanPolicyObjectMirrorProfileParcel(t *testing.T) { - if os.Getenv("SDWAN_2012") == "" { - t.Skip("skipping test, set environment variable SDWAN_2012") + if os.Getenv("SDWAN_2012") == "" && os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") == "" { + t.Skip("skipping test, set environment variable SDWAN_2012 or POLICY_OBJECT_FEATURE_TEMPLATE_ID") } var checks []resource.TestCheckFunc checks = append(checks, resource.TestCheckResourceAttr("sdwan_policy_object_mirror_profile_parcel.test", "entries.0.remote_destination_ip", "10.0.0.1")) @@ -40,10 +40,10 @@ func TestAccSdwanPolicyObjectMirrorProfileParcel(t *testing.T) { ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, Steps: []resource.TestStep{ { - Config: testAccSdwanPolicyObjectMirrorPrerequisitesProfileParcelConfig + testAccSdwanPolicyObjectMirrorProfileParcelConfig_minimum(), + Config: testAccSdwanPolicyObjectMirrorProfileParcelConfig_minimum(), }, { - Config: testAccSdwanPolicyObjectMirrorPrerequisitesProfileParcelConfig + testAccSdwanPolicyObjectMirrorProfileParcelConfig_all(), + Config: testAccSdwanPolicyObjectMirrorProfileParcelConfig_all(), Check: resource.ComposeTestCheckFunc(checks...), }, }, @@ -53,13 +53,6 @@ func TestAccSdwanPolicyObjectMirrorProfileParcel(t *testing.T) { // End of section. //template:end testAcc // Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites -const testAccSdwanPolicyObjectMirrorPrerequisitesProfileParcelConfig = ` -resource "sdwan_policy_object_feature_profile" "test" { - name = "TF_TEST" - description = "Terraform test" -} -` - // End of section. //template:end testPrerequisites // Section below is generated&owned by "gen/generator.go". //template:begin testAccConfigMinimum @@ -67,7 +60,7 @@ func testAccSdwanPolicyObjectMirrorProfileParcelConfig_minimum() string { config := `resource "sdwan_policy_object_mirror_profile_parcel" "test" {` + "\n" config += ` name = "TF_TEST_MIN"` + "\n" config += ` description = "Terraform integration test"` + "\n" - config += ` feature_profile_id = sdwan_policy_object_feature_profile.test.id` + "\n" + config += ` feature_profile_id = ` + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + `` + "\n" config += ` entries = [{` + "\n" config += ` remote_destination_ip = "10.0.0.1"` + "\n" config += ` source_ip = "10.0.0.2"` + "\n" @@ -83,7 +76,7 @@ func testAccSdwanPolicyObjectMirrorProfileParcelConfig_all() string { config := `resource "sdwan_policy_object_mirror_profile_parcel" "test" {` + "\n" config += ` name = "TF_TEST_ALL"` + "\n" config += ` description = "Terraform integration test"` + "\n" - config += ` feature_profile_id = sdwan_policy_object_feature_profile.test.id` + "\n" + config += ` feature_profile_id = ` + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + `` + "\n" config += ` entries = [{` + "\n" config += ` remote_destination_ip = "10.0.0.1"` + "\n" config += ` source_ip = "10.0.0.2"` + "\n" diff --git a/internal/provider/resource_sdwan_policy_object_policer_profile_parcel_test.go b/internal/provider/resource_sdwan_policy_object_policer_profile_parcel_test.go index 66881173..eb176e21 100644 --- a/internal/provider/resource_sdwan_policy_object_policer_profile_parcel_test.go +++ b/internal/provider/resource_sdwan_policy_object_policer_profile_parcel_test.go @@ -29,8 +29,8 @@ import ( // Section below is generated&owned by "gen/generator.go". //template:begin testAcc func TestAccSdwanPolicyObjectPolicerProfileParcel(t *testing.T) { - if os.Getenv("SDWAN_2012") == "" { - t.Skip("skipping test, set environment variable SDWAN_2012") + if os.Getenv("SDWAN_2012") == "" && os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") == "" { + t.Skip("skipping test, set environment variable SDWAN_2012 or POLICY_OBJECT_FEATURE_TEMPLATE_ID") } var checks []resource.TestCheckFunc checks = append(checks, resource.TestCheckResourceAttr("sdwan_policy_object_policer_profile_parcel.test", "entries.0.burst_bytes", "56500")) @@ -41,10 +41,10 @@ func TestAccSdwanPolicyObjectPolicerProfileParcel(t *testing.T) { ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, Steps: []resource.TestStep{ { - Config: testAccSdwanPolicyObjectPolicerPrerequisitesProfileParcelConfig + testAccSdwanPolicyObjectPolicerProfileParcelConfig_minimum(), + Config: testAccSdwanPolicyObjectPolicerProfileParcelConfig_minimum(), }, { - Config: testAccSdwanPolicyObjectPolicerPrerequisitesProfileParcelConfig + testAccSdwanPolicyObjectPolicerProfileParcelConfig_all(), + Config: testAccSdwanPolicyObjectPolicerProfileParcelConfig_all(), Check: resource.ComposeTestCheckFunc(checks...), }, }, @@ -54,13 +54,6 @@ func TestAccSdwanPolicyObjectPolicerProfileParcel(t *testing.T) { // End of section. //template:end testAcc // Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites -const testAccSdwanPolicyObjectPolicerPrerequisitesProfileParcelConfig = ` -resource "sdwan_policy_object_feature_profile" "test" { - name = "TF_TEST" - description = "Terraform test" -} -` - // End of section. //template:end testPrerequisites // Section below is generated&owned by "gen/generator.go". //template:begin testAccConfigMinimum @@ -68,7 +61,7 @@ func testAccSdwanPolicyObjectPolicerProfileParcelConfig_minimum() string { config := `resource "sdwan_policy_object_policer_profile_parcel" "test" {` + "\n" config += ` name = "TF_TEST_MIN"` + "\n" config += ` description = "Terraform integration test"` + "\n" - config += ` feature_profile_id = sdwan_policy_object_feature_profile.test.id` + "\n" + config += ` feature_profile_id = ` + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + `` + "\n" config += ` entries = [{` + "\n" config += ` burst_bytes = 56500` + "\n" config += ` select_value = "remark"` + "\n" @@ -85,7 +78,7 @@ func testAccSdwanPolicyObjectPolicerProfileParcelConfig_all() string { config := `resource "sdwan_policy_object_policer_profile_parcel" "test" {` + "\n" config += ` name = "TF_TEST_ALL"` + "\n" config += ` description = "Terraform integration test"` + "\n" - config += ` feature_profile_id = sdwan_policy_object_feature_profile.test.id` + "\n" + config += ` feature_profile_id = ` + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + `` + "\n" config += ` entries = [{` + "\n" config += ` burst_bytes = 56500` + "\n" config += ` select_value = "remark"` + "\n" diff --git a/internal/provider/resource_sdwan_policy_object_prefix_profile_parcel_test.go b/internal/provider/resource_sdwan_policy_object_prefix_profile_parcel_test.go index d2a6f317..37785834 100644 --- a/internal/provider/resource_sdwan_policy_object_prefix_profile_parcel_test.go +++ b/internal/provider/resource_sdwan_policy_object_prefix_profile_parcel_test.go @@ -29,8 +29,8 @@ import ( // Section below is generated&owned by "gen/generator.go". //template:begin testAcc func TestAccSdwanPolicyObjectPrefixProfileParcel(t *testing.T) { - if os.Getenv("SDWAN_2012") == "" { - t.Skip("skipping test, set environment variable SDWAN_2012") + if os.Getenv("SDWAN_2012") == "" && os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") == "" { + t.Skip("skipping test, set environment variable SDWAN_2012 or POLICY_OBJECT_FEATURE_TEMPLATE_ID") } var checks []resource.TestCheckFunc checks = append(checks, resource.TestCheckResourceAttr("sdwan_policy_object_prefix_profile_parcel.test", "entries.0.ipv4_address", "10.0.0.0")) @@ -42,10 +42,10 @@ func TestAccSdwanPolicyObjectPrefixProfileParcel(t *testing.T) { ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, Steps: []resource.TestStep{ { - Config: testAccSdwanPolicyObjectPrefixPrerequisitesProfileParcelConfig + testAccSdwanPolicyObjectPrefixProfileParcelConfig_minimum(), + Config: testAccSdwanPolicyObjectPrefixProfileParcelConfig_minimum(), }, { - Config: testAccSdwanPolicyObjectPrefixPrerequisitesProfileParcelConfig + testAccSdwanPolicyObjectPrefixProfileParcelConfig_all(), + Config: testAccSdwanPolicyObjectPrefixProfileParcelConfig_all(), Check: resource.ComposeTestCheckFunc(checks...), }, }, @@ -55,13 +55,6 @@ func TestAccSdwanPolicyObjectPrefixProfileParcel(t *testing.T) { // End of section. //template:end testAcc // Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites -const testAccSdwanPolicyObjectPrefixPrerequisitesProfileParcelConfig = ` -resource "sdwan_policy_object_feature_profile" "test" { - name = "TF_TEST" - description = "Terraform test" -} -` - // End of section. //template:end testPrerequisites // Section below is generated&owned by "gen/generator.go". //template:begin testAccConfigMinimum @@ -69,7 +62,7 @@ func testAccSdwanPolicyObjectPrefixProfileParcelConfig_minimum() string { config := `resource "sdwan_policy_object_prefix_profile_parcel" "test" {` + "\n" config += ` name = "TF_TEST_MIN"` + "\n" config += ` description = "Terraform integration test"` + "\n" - config += ` feature_profile_id = sdwan_policy_object_feature_profile.test.id` + "\n" + config += ` feature_profile_id = ` + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + `` + "\n" config += ` entries = [{` + "\n" config += ` ipv4_address = "10.0.0.0"` + "\n" config += ` ipv4_prefix_length = 8` + "\n" @@ -87,7 +80,7 @@ func testAccSdwanPolicyObjectPrefixProfileParcelConfig_all() string { config := `resource "sdwan_policy_object_prefix_profile_parcel" "test" {` + "\n" config += ` name = "TF_TEST_ALL"` + "\n" config += ` description = "Terraform integration test"` + "\n" - config += ` feature_profile_id = sdwan_policy_object_feature_profile.test.id` + "\n" + config += ` feature_profile_id = ` + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + `` + "\n" config += ` entries = [{` + "\n" config += ` ipv4_address = "10.0.0.0"` + "\n" config += ` ipv4_prefix_length = 8` + "\n" diff --git a/internal/provider/resource_sdwan_policy_object_tloc_profile_parcel_test.go b/internal/provider/resource_sdwan_policy_object_tloc_profile_parcel_test.go index 03a67b70..816324ef 100644 --- a/internal/provider/resource_sdwan_policy_object_tloc_profile_parcel_test.go +++ b/internal/provider/resource_sdwan_policy_object_tloc_profile_parcel_test.go @@ -29,8 +29,8 @@ import ( // Section below is generated&owned by "gen/generator.go". //template:begin testAcc func TestAccSdwanPolicyObjectTLOCProfileParcel(t *testing.T) { - if os.Getenv("SDWAN_2012") == "" { - t.Skip("skipping test, set environment variable SDWAN_2012") + if os.Getenv("SDWAN_2012") == "" && os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") == "" { + t.Skip("skipping test, set environment variable SDWAN_2012 or POLICY_OBJECT_FEATURE_TEMPLATE_ID") } var checks []resource.TestCheckFunc checks = append(checks, resource.TestCheckResourceAttr("sdwan_policy_object_tloc_profile_parcel.test", "entries.0.tloc", "10.0.0.0")) @@ -42,10 +42,10 @@ func TestAccSdwanPolicyObjectTLOCProfileParcel(t *testing.T) { ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, Steps: []resource.TestStep{ { - Config: testAccSdwanPolicyObjectTLOCPrerequisitesProfileParcelConfig + testAccSdwanPolicyObjectTLOCProfileParcelConfig_minimum(), + Config: testAccSdwanPolicyObjectTLOCProfileParcelConfig_minimum(), }, { - Config: testAccSdwanPolicyObjectTLOCPrerequisitesProfileParcelConfig + testAccSdwanPolicyObjectTLOCProfileParcelConfig_all(), + Config: testAccSdwanPolicyObjectTLOCProfileParcelConfig_all(), Check: resource.ComposeTestCheckFunc(checks...), }, }, @@ -55,13 +55,6 @@ func TestAccSdwanPolicyObjectTLOCProfileParcel(t *testing.T) { // End of section. //template:end testAcc // Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites -const testAccSdwanPolicyObjectTLOCPrerequisitesProfileParcelConfig = ` -resource "sdwan_policy_object_feature_profile" "test" { - name = "TF_TEST" - description = "Terraform test" -} -` - // End of section. //template:end testPrerequisites // Section below is generated&owned by "gen/generator.go". //template:begin testAccConfigMinimum @@ -69,7 +62,7 @@ func testAccSdwanPolicyObjectTLOCProfileParcelConfig_minimum() string { config := `resource "sdwan_policy_object_tloc_profile_parcel" "test" {` + "\n" config += ` name = "TF_TEST_MIN"` + "\n" config += ` description = "Terraform integration test"` + "\n" - config += ` feature_profile_id = sdwan_policy_object_feature_profile.test.id` + "\n" + config += ` feature_profile_id = ` + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + `` + "\n" config += ` entries = [{` + "\n" config += ` tloc = "10.0.0.0"` + "\n" config += ` color = "3g"` + "\n" @@ -87,7 +80,7 @@ func testAccSdwanPolicyObjectTLOCProfileParcelConfig_all() string { config := `resource "sdwan_policy_object_tloc_profile_parcel" "test" {` + "\n" config += ` name = "TF_TEST_ALL"` + "\n" config += ` description = "Terraform integration test"` + "\n" - config += ` feature_profile_id = sdwan_policy_object_feature_profile.test.id` + "\n" + config += ` feature_profile_id = ` + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + `` + "\n" config += ` entries = [{` + "\n" config += ` tloc = "10.0.0.0"` + "\n" config += ` color = "3g"` + "\n"