diff --git a/ibm/service/power/ibm_pi_constants.go b/ibm/service/power/ibm_pi_constants.go index bb711f778f..e6672bd544 100644 --- a/ibm/service/power/ibm_pi_constants.go +++ b/ibm/service/power/ibm_pi_constants.go @@ -189,7 +189,6 @@ const ( Attr_Key = "key" Attr_KeyCreationDate = "creation_date" Attr_KeyID = "key_id" - Attr_KeyName = "name" Attr_Keys = "keys" Attr_Language = "language" Attr_LastUpdateDate = "last_update_date" diff --git a/ibm/service/power/resource_ibm_pi_key.go b/ibm/service/power/resource_ibm_pi_key.go index 2f2e2a4a78..259907394c 100644 --- a/ibm/service/power/resource_ibm_pi_key.go +++ b/ibm/service/power/resource_ibm_pi_key.go @@ -57,7 +57,7 @@ func ResourceIBMPIKey() *schema.Resource { Description: "Date of SSH Key creation.", Type: schema.TypeString, }, - Attr_KeyName: { + Attr_Name: { Computed: true, Description: "User defined name for the SSH key.", Type: schema.TypeString, @@ -121,9 +121,9 @@ func resourceIBMPIKeyRead(ctx context.Context, d *schema.ResourceData, meta inte } // set attributes - d.Set(Attr_KeyName, sshkeydata.Name) - d.Set(Attr_Key, sshkeydata.SSHKey) d.Set(Attr_CreationDate, sshkeydata.CreationDate.String()) + d.Set(Attr_Key, sshkeydata.SSHKey) + d.Set(Attr_Name, sshkeydata.Name) return nil } diff --git a/ibm/service/power/resource_ibm_pi_key_test.go b/ibm/service/power/resource_ibm_pi_key_test.go index b1da977d81..1059989ddf 100644 --- a/ibm/service/power/resource_ibm_pi_key_test.go +++ b/ibm/service/power/resource_ibm_pi_key_test.go @@ -101,5 +101,5 @@ func testAccCheckIBMPIKeyConfig(publicKey, name string) string { pi_cloud_instance_id = "%s" pi_key_name = "%s" pi_ssh_key = "%s" - }`, acc.Pi_cloud_instance_id, name, publicKey) + }`, acc.Pi_cloud_instance_id, name, publicKey) } diff --git a/website/docs/r/pi_key.html.markdown b/website/docs/r/pi_key.html.markdown index 94bbc23c1b..d0f33b6bae 100644 --- a/website/docs/r/pi_key.html.markdown +++ b/website/docs/r/pi_key.html.markdown @@ -7,9 +7,11 @@ description: |- --- # ibm_pi_key + Create, update, or delete an SSH key for your Power Systems Virtual Server instance. The SSH key is used to access the instance after it is created. For more information, about SSH keys in Power Virtual Server, see [getting started with IBM Power Systems Virtual Servers](https://cloud.ibm.com/docs/power-iaas?topic=power-iaas-getting-started). ## Example usage + The following example enables you to create a SSH key to be used during creation of a power virtual server instance: ```terraform @@ -20,13 +22,15 @@ resource "ibm_pi_key" "testacc_sshkey" { } ``` -**Notes** +### Notes + - Please find [supported Regions](https://cloud.ibm.com/apidocs/power-cloud#endpoint) for endpoints. - If a Power cloud instance is provisioned at `lon04`, The provider level attributes should be as follows: - `region` - `lon` - `zone` - `lon04` Example usage: + ```terraform provider "ibm" { region = "lon" @@ -35,30 +39,35 @@ Example usage: ``` ## Timeouts + ibm_pi_key provides the following [timeouts](https://www.terraform.io/docs/language/resources/syntax.html) configuration options: - **create** - (Default 60 minutes) Used for creating a SSH key. - **delete** - (Default 60 minutes) Used for deleting a SSH key. ## Argument reference -Review the argument references that you can specify for your resource. + +Review the argument references that you can specify for your resource. - `pi_cloud_instance_id` - (Required, String) The GUID of the service instance associated with an account. -- `pi_key_name` - (Required, String) User defined name for the SSH key. -- `pi_ssh_key` - (Required, String) SSH RSA key. +- `pi_key_name` - (Required, String) User defined name for the SSH key. +- `pi_ssh_key` - (Required, String) SSH RSA key. ## Attribute reference + In addition to all argument reference list, you can access the following attribute reference after your resource is created. -- `creation_date` - (String) Date of SSH Key creation. +- `creation_date` - (String) Date of SSH Key creation. - `id` - (String) The unique identifier of the key. The ID is composed of `/`. - `name` - (String) User defined name for the SSH key. - `ssh_key` - (String) SSH RSA key. ## Import + The `ibm_pi_key` resource can be imported by using `pi_cloud_instance_id` and `pi_key_name`. -**Example** +### Example + +```bash +terraform import ibm_pi_key.example d7bec597-4726-451f-8a63-e62e6f19c32c/mykey ``` -$ terraform import ibm_pi_key.example d7bec597-4726-451f-8a63-e62e6f19c32c/mykey -``` \ No newline at end of file