From b8ada5f48ba4070371fbf19f844cebb37e02235a Mon Sep 17 00:00:00 2001 From: Chuyi Ching Date: Fri, 26 Jul 2024 17:47:12 -0700 Subject: [PATCH 1/3] fix attribute checking --- CHANGELOG.md | 5 +++++ docs/resources/protocols_cifs_service_resource.md | 4 ++-- internal/provider/protocols_cifs_service_resource.go | 10 ++-------- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d9b1dea6..4b26aee2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 1.1.3 + +BUG FIXES: +* **netapp-ontap_protocols_cifs_service_resource**: fixed on attribute checking ([#250](https://github.com/NetApp/terraform-provider-netapp-ontap/issues/250)) + ## 1.1.2 (2024-06-03) ENHANCEMENTS: diff --git a/docs/resources/protocols_cifs_service_resource.md b/docs/resources/protocols_cifs_service_resource.md index 709be773..00f4a301 100644 --- a/docs/resources/protocols_cifs_service_resource.md +++ b/docs/resources/protocols_cifs_service_resource.md @@ -119,10 +119,10 @@ Optional: Optional: -- `advertised_kdc_encryptions` (Set of String) List of advertised KDC encryptions +- `advertised_kdc_encryptions` (Set of String) List of advertised KDC encryptions (9.12) - `aes_netlogon_enabled` (Boolean) An AES session key is enabled for the Netlogon channel (9.10) - `encrypt_dc_connection` (Boolean) Encryption is required for domain controller connections (9.8) -- `kdc_encryption` (Boolean) Specifies whether AES-128 and AES-256 encryption is enabled for all Kerberos-based communication with the Active Directory KDC +- `kdc_encryption` (Boolean) Specifies whether AES-128 and AES-256 encryption is enabled for all Kerberos-based communication with the Active Directory KDC. Deprecated in 9.12. Use 'advertised_kdc_encryptions' instead. - `ldap_referral_enabled` (Boolean) Specifies if LDAP referral chasing is enabled for AD LDAP connections (9.10) - `lm_compatibility_level` (String) CIFS server minimum security level - `restrict_anonymous` (String) Specifies what level of access an anonymous user is granted diff --git a/internal/provider/protocols_cifs_service_resource.go b/internal/provider/protocols_cifs_service_resource.go index 714fcb2c..190321a2 100644 --- a/internal/provider/protocols_cifs_service_resource.go +++ b/internal/provider/protocols_cifs_service_resource.go @@ -5,7 +5,6 @@ import ( "fmt" "strings" - "github.com/hashicorp/terraform-plugin-framework-validators/boolvalidator" "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/diag" @@ -255,12 +254,7 @@ func (r *CifsServiceResource) Schema(ctx context.Context, req resource.SchemaReq PlanModifiers: []planmodifier.Bool{ boolplanmodifier.UseStateForUnknown(), }, - Validators: []validator.Bool{ - boolvalidator.ConflictsWith(path.Expressions{ - path.MatchRoot("advertised_kdc_encryptions"), - }...), - }, - MarkdownDescription: "Specifies whether AES-128 and AES-256 encryption is enabled for all Kerberos-based communication with the Active Directory KDC", + MarkdownDescription: "Specifies whether AES-128 and AES-256 encryption is enabled for all Kerberos-based communication with the Active Directory KDC. Deprecated in 9.12. Use 'advertised_kdc_encryptions' instead.", }, "lm_compatibility_level": schema.StringAttribute{ Optional: true, @@ -338,7 +332,7 @@ func (r *CifsServiceResource) Schema(ctx context.Context, req resource.SchemaReq PlanModifiers: []planmodifier.Set{ setplanmodifier.UseStateForUnknown(), }, - MarkdownDescription: "List of advertised KDC encryptions", + MarkdownDescription: "List of advertised KDC encryptions (9.12)", ElementType: types.StringType, }, }, From ec00bd593892fa2f838d3b8df1e1c5b851b2916a Mon Sep 17 00:00:00 2001 From: Chuyi Ching Date: Fri, 26 Jul 2024 18:05:44 -0700 Subject: [PATCH 2/3] fix acc test --- internal/provider/snapmirror_resource_test.go | 26 +++++++++---------- internal/provider/svm_peers_resource_test.go | 8 +++--- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/internal/provider/snapmirror_resource_test.go b/internal/provider/snapmirror_resource_test.go index 6f24c3a5..66929ffb 100644 --- a/internal/provider/snapmirror_resource_test.go +++ b/internal/provider/snapmirror_resource_test.go @@ -16,31 +16,31 @@ func TestAccSnapmirrorResource(t *testing.T) { Steps: []resource.TestStep{ // Test non existant Vol { - Config: testAccSnapmirrorResourceBasicConfig("snapmirror_dest_svm:testme", "snapmirror_dest_svm:testme"), + Config: testAccSnapmirrorResourceBasicConfig("tf_peer:testme", "terraform:testme"), ExpectError: regexp.MustCompile("6619337"), }, // Create snapmirror and read { - Config: testAccSnapmirrorResourceBasicConfig("snapmirror_dest_svm:snap_dest3", "snapmirror_dest_svm:snap_dest2"), + Config: testAccSnapmirrorResourceBasicConfig("tf_peer:snap_source2", "terraform:snap_dest2"), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr("netapp-ontap_snapmirror_resource.example", "destination_endpoint.path", "snapmirror_dest_svm:snap_dest2"), + resource.TestCheckResourceAttr("netapp-ontap_snapmirror_resource.example", "destination_endpoint.path", "terraform:snap_dest2"), ), }, // Update a policy { - Config: testAccSnapmirrorResourceUpdateConfig("snapmirror_dest_svm:snap_dest", "snapmirror_source_svm:snap", "MirrorAndVault"), + Config: testAccSnapmirrorResourceUpdateConfig("tf_peer:snap_source", "terraform:snap_dest", "MirrorAndVault"), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("netapp-ontap_snapmirror_resource.example", "policy.name", "MirrorAndVault"), - resource.TestCheckResourceAttr("netapp-ontap_snapmirror_resource.example", "destination_endpoint.path", "snapmirror_source_svm:snap"), + resource.TestCheckResourceAttr("netapp-ontap_snapmirror_resource.example", "destination_endpoint.path", "terraform:snap_dest"), ), }, // Import and read { ResourceName: "netapp-ontap_snapmirror_resource.example", ImportState: true, - ImportStateId: fmt.Sprintf("%s,%s", "snapmirror_dest_svm:snap_dest2", "cluster4"), + ImportStateId: fmt.Sprintf("%s,%s", "terraform:snap_dest", "cluster4"), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr("netapp-ontap_snapmirror_resource.example", "destination_endpoint.path", "snapmirror_dest_svm:snap_dest2"), + resource.TestCheckResourceAttr("netapp-ontap_snapmirror_resource.example", "destination_endpoint.path", "terraform:snap_dest"), ), }, // Delete testing automatically occurs in TestCase @@ -49,11 +49,11 @@ func TestAccSnapmirrorResource(t *testing.T) { } func testAccSnapmirrorResourceBasicConfig(sourceEndpoint string, destinationEndpoint string) string { - host := os.Getenv("TF_ACC_NETAPP_HOST4") + host := os.Getenv("TF_ACC_NETAPP_HOST5") admin := os.Getenv("TF_ACC_NETAPP_USER") - password := os.Getenv("TF_ACC_NETAPP_PASS") + password := os.Getenv("TF_ACC_NETAPP_PASS2") if host == "" || admin == "" || password == "" { - fmt.Println("TF_ACC_NETAPP_HOST4, TF_ACC_NETAPP_USER, and TF_ACC_NETAPP_PASS must be set for acceptance tests") + fmt.Println("TF_ACC_NETAPP_HOST5, TF_ACC_NETAPP_USER, and TF_ACC_NETAPP_PASS must be set for acceptance tests") os.Exit(1) } return fmt.Sprintf(` @@ -81,11 +81,11 @@ resource "netapp-ontap_snapmirror_resource" "example" { } func testAccSnapmirrorResourceUpdateConfig(sourceEndpoint string, destinationEndpoint string, policy string) string { - host := os.Getenv("TF_ACC_NETAPP_HOST4") + host := os.Getenv("TF_ACC_NETAPP_HOST5") admin := os.Getenv("TF_ACC_NETAPP_USER") - password := os.Getenv("TF_ACC_NETAPP_PASS") + password := os.Getenv("TF_ACC_NETAPP_PASS2") if host == "" || admin == "" || password == "" { - fmt.Println("TF_ACC_NETAPP_HOST4, TF_ACC_NETAPP_USER, and TF_ACC_NETAPP_PASS must be set for acceptance tests") + fmt.Println("TF_ACC_NETAPP_HOST5, TF_ACC_NETAPP_USER, and TF_ACC_NETAPP_PASS must be set for acceptance tests") os.Exit(1) } return fmt.Sprintf(` diff --git a/internal/provider/svm_peers_resource_test.go b/internal/provider/svm_peers_resource_test.go index 72348c24..aa8b0681 100644 --- a/internal/provider/svm_peers_resource_test.go +++ b/internal/provider/svm_peers_resource_test.go @@ -39,7 +39,7 @@ func TestAccSvmPeersResource(t *testing.T) { { ResourceName: "netapp-ontap_svm_peers_resource.example", ImportState: true, - ImportStateId: fmt.Sprintf("%s,%s,%s,%s", "snapmirror_dest_dp", "snapmirror_dest_svm", "swenjuncluster-1", "cluster4"), + ImportStateId: fmt.Sprintf("%s,%s,%s,%s", "terraform", "tf_peer", "swenjuncluster-1", "cluster4"), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("netapp-ontap_svm_peers_resource.example", "svm.name", "snapmirror_dest_dp"), ), @@ -48,13 +48,13 @@ func TestAccSvmPeersResource(t *testing.T) { }) } func testAccSvmPeersResourceConfig(svm, peerSvm, peerCluster, applications string) string { - host := os.Getenv("TF_ACC_NETAPP_HOST4") + host := os.Getenv("TF_ACC_NETAPP_HOST5") admin := os.Getenv("TF_ACC_NETAPP_USER") password := os.Getenv("TF_ACC_NETAPP_PASS") password2 := os.Getenv("TF_ACC_NETAPP_PASS2") host2 := os.Getenv("TF_ACC_NETAPP_HOST2") if host == "" || admin == "" || password == "" { - fmt.Println("TF_ACC_NETAPP_HOST2, TF_ACC_NETAPP_HOST4, TF_ACC_NETAPP_USER, TF_ACC_NETAPP_PASS2 and TF_ACC_NETAPP_PASS must be set for acceptance tests") + fmt.Println("TF_ACC_NETAPP_HOST2, TF_ACC_NETAPP_HOST5, TF_ACC_NETAPP_USER, TF_ACC_NETAPP_PASS2 and TF_ACC_NETAPP_PASS must be set for acceptance tests") os.Exit(1) } return fmt.Sprintf(` @@ -92,5 +92,5 @@ resource "netapp-ontap_svm_peers_resource" "example" { peer_cx_profile_name = "cluster3" } applications = ["%s"] -}`, host, admin, password, host2, admin, password2, svm, peerSvm, peerCluster, applications) +}`, host, admin, password2, host2, admin, password2, svm, peerSvm, peerCluster, applications) } From 59475fe6513753e59fb6c175f6c59b71716a6670 Mon Sep 17 00:00:00 2001 From: Chuyi Ching Date: Fri, 26 Jul 2024 18:14:48 -0700 Subject: [PATCH 3/3] fix acc test --- .github/workflows/acc_test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/acc_test.yml b/.github/workflows/acc_test.yml index b43da20c..1435bd8b 100644 --- a/.github/workflows/acc_test.yml +++ b/.github/workflows/acc_test.yml @@ -25,6 +25,7 @@ jobs: TF_ACC_NETAPP_HOST2: ${{ secrets.TF_ACC_NETAPP_HOST2 }} TF_ACC_NETAPP_HOST3: ${{ secrets.TF_ACC_NETAPP_HOST3 }} TF_ACC_NETAPP_HOST4: ${{ secrets.TF_ACC_NETAPP_HOST4 }} + TF_ACC_NETAPP_HOST5: ${{ secrets.TF_ACC_NETAPP_HOST5 }} TF_ACC_NETAPP_HOST_CIFS: ${{ secrets.TF_ACC_NETAPP_HOST_CIFS }} TF_ACC_NETAPP_USER: ${{ secrets.TF_ACC_NETAPP_USER }} TF_ACC_NETAPP_PASS: ${{ secrets.TF_ACC_NETAPP_PASS }}