-
Notifications
You must be signed in to change notification settings - Fork 133
fix(iam_ssh_key): do not read public key in resource #2695
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Codelax
wants to merge
2
commits into
scaleway:master
from
Codelax:fix/iam-ssh-key-public-key-formatted
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,7 +12,6 @@ import ( | |
| func TestAccSSHKeyAccount_basic(t *testing.T) { | ||
| name := "tf-test-account-ssh-key-basic" | ||
| SSHKey := "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEEYrzDOZmhItdKaDAEqJQ4ORS2GyBMtBozYsK5kiXXX [email protected]" | ||
| FormattedSSHKey := "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEEYrzDOZmhItdKaDAEqJQ4ORS2GyBMtBozYsK5kiXXX" | ||
| tt := acctest.NewTestTools(t) | ||
| defer tt.Cleanup() | ||
|
|
||
|
|
@@ -31,7 +30,7 @@ func TestAccSSHKeyAccount_basic(t *testing.T) { | |
| Check: resource.ComposeTestCheckFunc( | ||
| iamchecks.CheckSSHKeyExists(tt, "scaleway_account_ssh_key.main"), | ||
| resource.TestCheckResourceAttr("scaleway_account_ssh_key.main", "name", name), | ||
| resource.TestCheckResourceAttr("scaleway_account_ssh_key.main", "public_key", FormattedSSHKey), | ||
| resource.TestCheckResourceAttr("scaleway_account_ssh_key.main", "public_key", SSHKey), | ||
| ), | ||
| }, | ||
| { | ||
|
|
@@ -44,7 +43,7 @@ func TestAccSSHKeyAccount_basic(t *testing.T) { | |
| Check: resource.ComposeTestCheckFunc( | ||
| iamchecks.CheckSSHKeyExists(tt, "scaleway_account_ssh_key.main"), | ||
| resource.TestCheckResourceAttr("scaleway_account_ssh_key.main", "name", name+"-updated"), | ||
| resource.TestCheckResourceAttr("scaleway_account_ssh_key.main", "public_key", FormattedSSHKey), | ||
| resource.TestCheckResourceAttr("scaleway_account_ssh_key.main", "public_key", SSHKey), | ||
| ), | ||
| }, | ||
| }, | ||
|
|
@@ -54,7 +53,6 @@ func TestAccSSHKeyAccount_basic(t *testing.T) { | |
| func TestAccSSHKeyAccount_WithNewLine(t *testing.T) { | ||
| name := "tf-test-account-ssh-key-newline" | ||
| SSHKey := "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDjfkdWCwkYlVQMDUfiZlVrmjaGOfBYnmkucssae8Iup [email protected]" | ||
| FormattedSSHKey := "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDjfkdWCwkYlVQMDUfiZlVrmjaGOfBYnmkucssae8Iup" | ||
| tt := acctest.NewTestTools(t) | ||
| defer tt.Cleanup() | ||
|
|
||
|
|
@@ -73,7 +71,7 @@ func TestAccSSHKeyAccount_WithNewLine(t *testing.T) { | |
| Check: resource.ComposeTestCheckFunc( | ||
| iamchecks.CheckSSHKeyExists(tt, "scaleway_account_ssh_key.main"), | ||
| resource.TestCheckResourceAttr("scaleway_account_ssh_key.main", "name", name), | ||
| resource.TestCheckResourceAttr("scaleway_account_ssh_key.main", "public_key", FormattedSSHKey), | ||
| resource.TestCheckResourceAttr("scaleway_account_ssh_key.main", "public_key", SSHKey), | ||
| ), | ||
| }, | ||
| }, | ||
|
|
@@ -83,7 +81,6 @@ func TestAccSSHKeyAccount_WithNewLine(t *testing.T) { | |
| func TestAccSSHKeyAccount_ChangeResourceName(t *testing.T) { | ||
| name := "TestAccScalewayAccountSSHKey_ChangeResourceName" | ||
| SSHKey := "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICJEoOOgQBLJPs4g/XcPTKT82NywNPpxeuA20FlOPlpO [email protected]" | ||
| FormattedSSHKey := "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICJEoOOgQBLJPs4g/XcPTKT82NywNPpxeuA20FlOPlpO" | ||
| tt := acctest.NewTestTools(t) | ||
| defer tt.Cleanup() | ||
|
|
||
|
|
@@ -102,7 +99,7 @@ func TestAccSSHKeyAccount_ChangeResourceName(t *testing.T) { | |
| Check: resource.ComposeTestCheckFunc( | ||
| iamchecks.CheckSSHKeyExists(tt, "scaleway_account_ssh_key.first"), | ||
| resource.TestCheckResourceAttr("scaleway_account_ssh_key.first", "name", name), | ||
| resource.TestCheckResourceAttr("scaleway_account_ssh_key.first", "public_key", FormattedSSHKey), | ||
| resource.TestCheckResourceAttr("scaleway_account_ssh_key.first", "public_key", SSHKey), | ||
| ), | ||
| }, | ||
| { | ||
|
|
@@ -115,7 +112,7 @@ func TestAccSSHKeyAccount_ChangeResourceName(t *testing.T) { | |
| Check: resource.ComposeTestCheckFunc( | ||
| iamchecks.CheckSSHKeyExists(tt, "scaleway_account_ssh_key.second"), | ||
| resource.TestCheckResourceAttr("scaleway_account_ssh_key.second", "name", name), | ||
| resource.TestCheckResourceAttr("scaleway_account_ssh_key.second", "public_key", FormattedSSHKey), | ||
| resource.TestCheckResourceAttr("scaleway_account_ssh_key.second", "public_key", SSHKey), | ||
| ), | ||
| }, | ||
| }, | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,8 +10,7 @@ import ( | |
| ) | ||
|
|
||
| const ( | ||
| SSHKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICJEoOOgQBLJPs4g/XcPTKT82NywNPpxeuA20FlOPlpO [email protected]" | ||
| SSHKeyWithoutComment = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICJEoOOgQBLJPs4g/XcPTKT82NywNPpxeuA20FlOPlpO" | ||
| SSHKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICJEoOOgQBLJPs4g/XcPTKT82NywNPpxeuA20FlOPlpO [email protected]" | ||
| ) | ||
|
|
||
| func TestAccSSHKey_basic(t *testing.T) { | ||
|
|
@@ -34,7 +33,7 @@ func TestAccSSHKey_basic(t *testing.T) { | |
| Check: resource.ComposeTestCheckFunc( | ||
| iamchecks.CheckSSHKeyExists(tt, "scaleway_iam_ssh_key.main"), | ||
| resource.TestCheckResourceAttr("scaleway_iam_ssh_key.main", "name", name), | ||
| resource.TestCheckResourceAttr("scaleway_iam_ssh_key.main", "public_key", SSHKeyWithoutComment), | ||
| resource.TestCheckResourceAttr("scaleway_iam_ssh_key.main", "public_key", SSHKey), | ||
| ), | ||
| }, | ||
| { | ||
|
|
@@ -47,7 +46,7 @@ func TestAccSSHKey_basic(t *testing.T) { | |
| Check: resource.ComposeTestCheckFunc( | ||
| iamchecks.CheckSSHKeyExists(tt, "scaleway_iam_ssh_key.main"), | ||
| resource.TestCheckResourceAttr("scaleway_iam_ssh_key.main", "name", name+"-updated"), | ||
| resource.TestCheckResourceAttr("scaleway_iam_ssh_key.main", "public_key", SSHKeyWithoutComment), | ||
| resource.TestCheckResourceAttr("scaleway_iam_ssh_key.main", "public_key", SSHKey), | ||
| ), | ||
| }, | ||
| }, | ||
|
|
@@ -74,7 +73,7 @@ func TestAccSSHKey_WithNewLine(t *testing.T) { | |
| Check: resource.ComposeTestCheckFunc( | ||
| iamchecks.CheckSSHKeyExists(tt, "scaleway_iam_ssh_key.main"), | ||
| resource.TestCheckResourceAttr("scaleway_iam_ssh_key.main", "name", name), | ||
| resource.TestCheckResourceAttr("scaleway_iam_ssh_key.main", "public_key", SSHKeyWithoutComment), | ||
| resource.TestCheckResourceAttr("scaleway_iam_ssh_key.main", "public_key", SSHKey), | ||
| ), | ||
| }, | ||
| }, | ||
|
|
@@ -101,7 +100,7 @@ func TestAccSSHKey_ChangeResourceName(t *testing.T) { | |
| Check: resource.ComposeTestCheckFunc( | ||
| iamchecks.CheckSSHKeyExists(tt, "scaleway_iam_ssh_key.first"), | ||
| resource.TestCheckResourceAttr("scaleway_iam_ssh_key.first", "name", name), | ||
| resource.TestCheckResourceAttr("scaleway_iam_ssh_key.first", "public_key", SSHKeyWithoutComment), | ||
| resource.TestCheckResourceAttr("scaleway_iam_ssh_key.first", "public_key", SSHKey), | ||
| ), | ||
| }, | ||
| { | ||
|
|
@@ -114,7 +113,7 @@ func TestAccSSHKey_ChangeResourceName(t *testing.T) { | |
| Check: resource.ComposeTestCheckFunc( | ||
| iamchecks.CheckSSHKeyExists(tt, "scaleway_iam_ssh_key.second"), | ||
| resource.TestCheckResourceAttr("scaleway_iam_ssh_key.second", "name", name), | ||
| resource.TestCheckResourceAttr("scaleway_iam_ssh_key.second", "public_key", SSHKeyWithoutComment), | ||
| resource.TestCheckResourceAttr("scaleway_iam_ssh_key.second", "public_key", SSHKey), | ||
| ), | ||
| }, | ||
| }, | ||
|
|
@@ -141,7 +140,7 @@ func TestAccSSHKey_Disabled(t *testing.T) { | |
| Check: resource.ComposeTestCheckFunc( | ||
| iamchecks.CheckSSHKeyExists(tt, "scaleway_iam_ssh_key.main"), | ||
| resource.TestCheckResourceAttr("scaleway_iam_ssh_key.main", "name", name), | ||
| resource.TestCheckResourceAttr("scaleway_iam_ssh_key.main", "public_key", SSHKeyWithoutComment), | ||
| resource.TestCheckResourceAttr("scaleway_iam_ssh_key.main", "public_key", SSHKey), | ||
| resource.TestCheckResourceAttr("scaleway_iam_ssh_key.main", "disabled", "false"), | ||
| ), | ||
| }, | ||
|
|
@@ -156,7 +155,7 @@ func TestAccSSHKey_Disabled(t *testing.T) { | |
| Check: resource.ComposeTestCheckFunc( | ||
| iamchecks.CheckSSHKeyExists(tt, "scaleway_iam_ssh_key.main"), | ||
| resource.TestCheckResourceAttr("scaleway_iam_ssh_key.main", "name", name), | ||
| resource.TestCheckResourceAttr("scaleway_iam_ssh_key.main", "public_key", SSHKeyWithoutComment), | ||
| resource.TestCheckResourceAttr("scaleway_iam_ssh_key.main", "public_key", SSHKey), | ||
| resource.TestCheckResourceAttr("scaleway_iam_ssh_key.main", "disabled", "true"), | ||
| ), | ||
| }, | ||
|
|
@@ -171,7 +170,7 @@ func TestAccSSHKey_Disabled(t *testing.T) { | |
| Check: resource.ComposeTestCheckFunc( | ||
| iamchecks.CheckSSHKeyExists(tt, "scaleway_iam_ssh_key.main"), | ||
| resource.TestCheckResourceAttr("scaleway_iam_ssh_key.main", "name", name), | ||
| resource.TestCheckResourceAttr("scaleway_iam_ssh_key.main", "public_key", SSHKeyWithoutComment), | ||
| resource.TestCheckResourceAttr("scaleway_iam_ssh_key.main", "public_key", SSHKey), | ||
| resource.TestCheckResourceAttr("scaleway_iam_ssh_key.main", "disabled", "false"), | ||
| ), | ||
| }, | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.