mirror of
https://github.com/opentofu/opentofu.git
synced 2025-01-23 07:02:57 -06:00
aws_key_pair: Ensure key_name attribute is set
Ensure that the `key_name` attribute is available to `aws_key_pair` resource dependents, even when the attribute is not specifically set (i.e., when `key_name_prefix` or automatic naming is performed). Fixes #10983.
This commit is contained in:
parent
af5baf7b13
commit
af9505ffa2
@ -75,8 +75,10 @@ func resourceAwsKeyPairCreate(d *schema.ResourceData, meta interface{}) error {
|
||||
keyName = v.(string)
|
||||
} else if v, ok := d.GetOk("key_name_prefix"); ok {
|
||||
keyName = resource.PrefixedUniqueId(v.(string))
|
||||
d.Set("key_name", keyName)
|
||||
} else {
|
||||
keyName = resource.UniqueId()
|
||||
d.Set("key_name", keyName)
|
||||
}
|
||||
|
||||
publicKey := d.Get("public_key").(string)
|
||||
|
Loading…
Reference in New Issue
Block a user