diff --git a/README.md b/README.md index bff318fa..99570f59 100644 --- a/README.md +++ b/README.md @@ -97,10 +97,10 @@ Please see our detailed docs for individual resource usage. Below is a complex e ```hcl provider "boundary" { - addr = "http://127.0.0.1:9200" - auth_method_id = "ampw_1234567890" # changeme - password_auth_method_login_name = "myuser" # changeme - password_auth_method_password = "passpass" # changeme + addr = "http://127.0.0.1:9200" + auth_method_id = "ampw_1234567890" # changeme + auth_method_login_name = "myuser" # changeme + auth_method_password = "passpass" # changeme } variable "users" { diff --git a/docs/index.md b/docs/index.md index 40ddf4b0..87e1dd18 100644 --- a/docs/index.md +++ b/docs/index.md @@ -15,23 +15,23 @@ Do not keep your authentication password in HCL for production environments, use ```terraform provider "boundary" { - addr = "http://127.0.0.1:9200" - auth_method_id = "ampw_1234567890" # changeme - password_auth_method_login_name = "myuser" # changeme - password_auth_method_password = "passpass" # changeme + addr = "http://127.0.0.1:9200" + auth_method_id = "ampw_1234567890" # changeme + auth_method_login_name = "myuser" # changeme + auth_method_password = "passpass" # changeme } provider "boundary" { - addr = "http://127.0.0.1:9200" - password_auth_method_login_name = "myuser" - password_auth_method_password = "passpass" + addr = "http://127.0.0.1:9200" + auth_method_login_name = "myuser" + auth_method_password = "passpass" } provider "boundary" { - addr = "http://127.0.0.1:9200" - password_auth_method_login_name = "myuser" - password_auth_method_password = "passpass" - scope_id = "s_1234567890" + addr = "http://127.0.0.1:9200" + auth_method_login_name = "myuser" + auth_method_password = "passpass" + scope_id = "s_1234567890" } ``` diff --git a/examples/provider/provider.tf b/examples/provider/provider.tf index 265cfd9a..c52303b0 100644 --- a/examples/provider/provider.tf +++ b/examples/provider/provider.tf @@ -1,19 +1,19 @@ provider "boundary" { - addr = "http://127.0.0.1:9200" - auth_method_id = "ampw_1234567890" # changeme - password_auth_method_login_name = "myuser" # changeme - password_auth_method_password = "passpass" # changeme + addr = "http://127.0.0.1:9200" + auth_method_id = "ampw_1234567890" # changeme + auth_method_login_name = "myuser" # changeme + auth_method_password = "passpass" # changeme } provider "boundary" { - addr = "http://127.0.0.1:9200" - password_auth_method_login_name = "myuser" - password_auth_method_password = "passpass" + addr = "http://127.0.0.1:9200" + auth_method_login_name = "myuser" + auth_method_password = "passpass" } provider "boundary" { - addr = "http://127.0.0.1:9200" - password_auth_method_login_name = "myuser" - password_auth_method_password = "passpass" - scope_id = "s_1234567890" + addr = "http://127.0.0.1:9200" + auth_method_login_name = "myuser" + auth_method_password = "passpass" + scope_id = "s_1234567890" } diff --git a/internal/provider/provider_test.go b/internal/provider/provider_test.go index 314c4b6c..fa99f2ea 100644 --- a/internal/provider/provider_test.go +++ b/internal/provider/provider_test.go @@ -106,6 +106,19 @@ provider "boundary" { func testConfigWithDefaultAuthMethod(url string, res ...string) string { provider := fmt.Sprintf(` +provider "boundary" { + addr = "%s" + auth_method_login_name = "%s" + auth_method_password = "%s" +}`, url, tcLoginName, tcPassword) + + c := []string{provider} + c = append(c, res...) + return strings.Join(c, "\n") +} + +func testConfigWithDeprecatedAuthMethod(url string, res ...string) string { + provider := fmt.Sprintf(` provider "boundary" { addr = "%s" password_auth_method_login_name = "%s" @@ -256,6 +269,28 @@ func TestConfigWithDefaultAuthMethod(t *testing.T) { }) } +func TestConfigWithDeprecatedAuthMethod(t *testing.T) { + tc := controller.NewTestController(t, tcConfig...) + defer tc.Shutdown() + url := tc.ApiAddrs()[0] + + var provider *schema.Provider + resource.Test(t, resource.TestCase{ + IsUnitTest: true, + ProviderFactories: providerFactories(&provider), + CheckDestroy: testAccCheckScopeResourceDestroy(t, provider), + Steps: []resource.TestStep{ + { + Config: testConfigWithDeprecatedAuthMethod(url, fooOrg, firstProjectFoo, secondProject), + Check: resource.ComposeTestCheckFunc( + testAccCheckScopeResourceExists(provider, "boundary_scope.org1"), + testProviderTokenExists(provider), + ), + }, + }, + }) +} + func TestConfigWithoutAMPWCredentials(t *testing.T) { tc := controller.NewTestController(t, tcConfig...) defer tc.Shutdown()