Skip to content

Commit

Permalink
Merge pull request #82 from syseleven/sshkeyagent
Browse files Browse the repository at this point in the history
K8s-8565 Change sshkeyagent field to a bool pointer
  • Loading branch information
mmertdogann authored Sep 5, 2023
2 parents 7cd6c3f + d0dce58 commit a637231
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ require (
github.com/hashicorp/go-version v1.5.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.17.0
github.com/mitchellh/go-homedir v1.1.0
github.com/syseleven/go-metakube v0.0.0-20230807132826-2e9a3e9c216b
github.com/syseleven/go-metakube v0.0.0-20230901105753-2acbd56de0ef
go.uber.org/zap v1.19.0
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4
)
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,8 @@ github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PK
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/syseleven/go-metakube v0.0.0-20230807132826-2e9a3e9c216b h1:UHhAGAmluLK8VVJdWFD2rOf35DlNQIMkDlQcVdzSJRM=
github.com/syseleven/go-metakube v0.0.0-20230807132826-2e9a3e9c216b/go.mod h1:Wmf9qWGkFXBGAJxXuwGH+SH6eq9txahkGRpTUz/JFhY=
github.com/syseleven/go-metakube v0.0.0-20230901105753-2acbd56de0ef h1:vHHN4hkSmM1hkdDwO3/Ty3Ywwk5KHF69POdzRmo5sgk=
github.com/syseleven/go-metakube v0.0.0-20230901105753-2acbd56de0ef/go.mod h1:Wmf9qWGkFXBGAJxXuwGH+SH6eq9txahkGRpTUz/JFhY=
github.com/syseleven/terraform-plugin-sdk/v2 v2.17.0-sys11-1 h1:M2c981F8TnNf8yFGD51oHNzMYcIIQ6nbySBrvUQrckM=
github.com/syseleven/terraform-plugin-sdk/v2 v2.17.0-sys11-1/go.mod h1:tunSMaRkZLxRmsJZAFXiznrk8Vl+KJ+GAfW52tQMu7w=
github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4=
Expand Down
6 changes: 4 additions & 2 deletions metakube/resource_cluster_structure.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ func metakubeResourceClusterFlattenSpec(values clusterPreserveValues, in *models
att["update_window"] = flattenUpdateWindow(in.UpdateWindow)
}

att["enable_ssh_agent"] = in.EnableUserSSHKeyAgent
if in.EnableUserSSHKeyAgent != nil {
att["enable_ssh_agent"] = *in.EnableUserSSHKeyAgent
}

att["audit_logging"] = false
if in.AuditLogging != nil {
Expand Down Expand Up @@ -314,7 +316,7 @@ func metakubeResourceClusterExpandSpec(p []interface{}, dcName string, include f

if v, ok := in["enable_ssh_agent"]; ok && include("enable_ssh_agent") {
if vv, ok := v.(bool); ok {
obj.EnableUserSSHKeyAgent = vv
obj.EnableUserSSHKeyAgent = &vv
}
}

Expand Down
4 changes: 2 additions & 2 deletions metakube/resource_cluster_structure_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
)

func TestMetakubeClusterFlattenSpec(t *testing.T) {
trueBool := true
cases := []struct {
Input *models.ClusterSpec
ExpectedOutput []interface{}
Expand All @@ -20,7 +21,7 @@ func TestMetakubeClusterFlattenSpec(t *testing.T) {
Start: "Tue 02:00",
Length: "3h",
},
EnableUserSSHKeyAgent: true,
EnableUserSSHKeyAgent: &trueBool,
AuditLogging: &models.AuditLoggingSettings{},
Cloud: &models.CloudSpec{
DatacenterName: "eu-west-1",
Expand Down Expand Up @@ -83,7 +84,6 @@ func TestMetakubeClusterFlattenSpec(t *testing.T) {
"audit_logging": false,
"pod_security_policy": false,
"pod_node_selector": false,
"enable_ssh_agent": false,
},
},
},
Expand Down

0 comments on commit a637231

Please sign in to comment.