Skip to content

Commit 6553424

Browse files
committed
wip
1 parent bb1c02c commit 6553424

File tree

2 files changed

+34
-10
lines changed

2 files changed

+34
-10
lines changed

kubernetes/provider.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ func Provider() *schema.Provider {
160160
},
161161
Description: "Configuration block to use an exec-based credential plugin, e.g. call an external command to receive user credentials.",
162162
ConflictsWith: []string{"config_path", "config_paths", "token", "client_certificate", "client_key", "username", "password"},
163+
RequiredWith: []string{"host"},
163164
},
164165
},
165166

kubernetes/provider_test.go

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -673,39 +673,62 @@ func TestAccKubernetesProvider_config_paths_host_env_wantError(t *testing.T) {
673673
})
674674
}
675675

676-
func TestAccKubernetesProvider_token(t *testing.T) {
677-
676+
func TestAccKubernetesProvider_host(t *testing.T) {
678677
resource.Test(t, resource.TestCase{
679678
PreCheck: func() { testAccPreCheckInternal(t) },
680679
ProviderFactories: testAccProviderFactoriesInternal,
681680
Steps: []resource.TestStep{
682681
{
683682
Config: testAccKubernetesProviderConfig(
684-
providerConfig_token("test-token") +
685-
providerConfig_host("https://test-host"),
683+
providerConfig_host("https://test-host") +
684+
providerConfig_token("test-token"),
686685
),
687686
PlanOnly: true,
688687
ExpectNonEmptyPlan: true,
689688
},
690689
{
691690
Config: testAccKubernetesProviderConfig(
692-
providerConfig_token("test-token") +
693-
providerConfig_host("test-host"),
691+
providerConfig_host("http://test-host") +
692+
providerConfig_token("test-token"),
693+
),
694+
PlanOnly: true,
695+
ExpectNonEmptyPlan: true,
696+
},
697+
{
698+
Config: testAccKubernetesProviderConfig(
699+
providerConfig_host("https://127.0.0.1") +
700+
providerConfig_token("test-token"),
701+
),
702+
PlanOnly: true,
703+
ExpectNonEmptyPlan: true,
704+
},
705+
{
706+
Config: testAccKubernetesProviderConfig(
707+
providerConfig_host("test-host") +
708+
providerConfig_token("test-token"),
694709
),
695710
PlanOnly: true,
696711
ExpectNonEmptyPlan: true,
697-
// "token": all of `host,token` must be specified
698-
ExpectError: regexp.MustCompile(`Error: expected "host" to have a host, got test-host`),
712+
ExpectError: regexp.MustCompile(`Error: expected "host" to have a host, got test-host`),
699713
},
700714
{
701715
Config: testAccKubernetesProviderConfig(
702716
providerConfig_token("test-token"),
703717
),
704718
PlanOnly: true,
705719
ExpectNonEmptyPlan: true,
706-
// "token": all of `host,token` must be specified
720+
// "host": all of `host,token` must be specified
707721
ExpectError: regexp.MustCompile("host,token"),
708722
},
723+
{
724+
Config: testAccKubernetesProviderConfig(
725+
providerConfig_exec("test-exec"),
726+
),
727+
PlanOnly: true,
728+
ExpectNonEmptyPlan: true,
729+
// "exec": all of `host,exec` must be specified
730+
ExpectError: regexp.MustCompile("exec,host"),
731+
},
709732
},
710733
})
711734
}
@@ -774,7 +797,7 @@ func providerConfig_host(host string) string {
774797
`, host)
775798
}
776799

777-
func provider_exec(clusterName string) string {
800+
func providerConfig_exec(clusterName string) string {
778801
return fmt.Sprintf(`
779802
exec {
780803
api_version = "client.authentication.k8s.io/v1alpha1"

0 commit comments

Comments
 (0)