Skip to content

Commit

Permalink
correct doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Sébastien GLON committed Oct 24, 2017
1 parent 0a7181f commit 52e5ad6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
7 changes: 2 additions & 5 deletions google/resource_google_service_account_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,10 @@ func resourceGoogleServiceAccountKeyCreate(d *schema.ResourceData, meta interfac
serviceAccount := d.Get("service_account_id").(string)

r := &iam.CreateServiceAccountKeyRequest{
KeyAlgorithm: d.Get("key_algorithm").(string),
KeyAlgorithm: d.Get("key_algorithm").(string),
PrivateKeyType: d.Get("private_key_type").(string),
}

var err error

r.PrivateKeyType = d.Get("private_key_type").(string)

sak, err := config.clientIAM.Projects.ServiceAccounts.Keys.Create(serviceAccount, r).Do()
if err != nil {
return fmt.Errorf("Error creating service account key: %s", err)
Expand Down
4 changes: 3 additions & 1 deletion google/resource_google_service_account_key_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

// Test that a service account key can be created and destroyed
func TestAccGoogleServiceAccountKey_basic(t *testing.T) {
t.Parallel()
resourceName := "google_service_account_key.acceptance"
accountID := "a" + acctest.RandString(10)
displayName := "Terraform Test"
Expand All @@ -33,6 +34,7 @@ func TestAccGoogleServiceAccountKey_basic(t *testing.T) {
}

func TestAccGoogleServiceAccountKey_pgp(t *testing.T) {
t.Parallel()
resourceName := "google_service_account_key.acceptance"
accountID := "a" + acctest.RandString(10)
displayName := "Terraform Test"
Expand Down Expand Up @@ -101,7 +103,7 @@ resource "google_service_account_key" "acceptance" {
public_key_type = "TYPE_X509_PEM_FILE"
pgp_key = <<EOF
%s
EOF
EOF
}
`, account, name, key)
}
Expand Down
7 changes: 6 additions & 1 deletion website/docs/r/google_service_account_key.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ resource "google_service_account_key" "acceptance" {
## Argument Reference

The following arguments are supported:
* `name` - The name used for this key pair (not used on create)

* `service_account_id` - (Required) The Service account id of the Key Pair.

Expand All @@ -63,13 +62,19 @@ Without a PGP key, the private key material will be stored in state unencrypted.

The following attributes are exported in addition to the arguments listed above:

* `name` - The name used for this key pair

* `fingerprint` - The MD5 public key fingerprint as specified in section 4 of RFC 4716.

* `public_key` - The public key, base64 encoded

* `private_key` - The private key, base64 encoded. This is only populated

when creating a new key, and when no `pgp_key` is provided
* `private_key_encrypted` – The private key material, base 64 encoded and
encrypted with the given `pgp_key`. This is only populated when creating a new
key and `pgp_key` is supplied

* `private_key_fingerprint` - The MD5 public key fingerprint for the encrypted
private key

Expand Down

0 comments on commit 52e5ad6

Please sign in to comment.