chore: replace deprecated arguments in provider example (#617)

* chore: replace deprecated arguments in provider example

* chore: fix extra newline

* Revert "chore: fix extra newline"

This reverts commit cf2de60acfcf6c9499d0306243041f950a0851f6.

* Revert "chore: replace deprecated arguments in provider example"

This reverts commit 49a336f7684707edb36021eef7d11bb92e4fa1b4.

* chore: change example

* chore: update example in README

* chore: create a tests for the deprecated auth method
This commit is contained in:
Bruno Schaatsbergen authored and GitHub committed 2024-07-15 10:02:58 -04:00
1 parent 695e28a38b
commit f6539b969c
4 files changed
+61 -26

No files matched your search

+4 -4
View File
@@ -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" {
+11 -11
View File
@@ -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"
}
```
+11 -11
View File
@@ -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"
}
+35
View File
@@ -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()