full-rainbow-99384
04/09/2025, 5:43 AMengine/apiv6/me/sshKey
but I don’t see this option under ovh.me in pulumi-ovh. I saw that this option is called mainly when I try to reinstall the operating system through UI.
Am I doing something wrong and is it possible what I am doing?
@thankful-match-46035 mentioning you because I see that you are mainly maintaining/updating this repo.
And this is the code I have to create the vps in case you are curious:
/**
* Interface representing the configuration for a VPS instance.
*/
export interface VpsConfig {
/** The name of the VPS instance. */
name: string;
/** (Optional) Arguments for creating a new OVH VPS instance. */
args?: ovh.vps.VpsArgs;
/** (Optional) Custom resource options for the VPS instance. */
opts?: pulumi.CustomResourceOptions;
}
/**
* Retrieves information about an existing OVH VPS instance.
*
* @param name The name of the VPS instance to retrieve.
* @returns A promise that resolves to the VPS information.
* @throws An error if the VPS retrieval fails.
*/
export const retrieveExistingVps = async (name: string): Promise<ovh.vps.GetVpsResult> => {
try {
const vps = await ovh.vps.getVps({ serviceName: name });
return vps;
} catch (error) {
console.error(`Failed to retrieve VPS with name ${name}:`, error);
throw error;
}
};
/**
* Creates a new OVH VPS instance.
*
* @param vpsConfig The configuration for the new VPS instance.
* @returns A promise that resolves to the details of the created VPS.
* @throws An error if the VPS creation fails or if the configuration is missing.
*/
export const createVps = (vpsConfig: VpsConfig): pulumi.Output<ovh.vps.GetVpsResult> => {
if (!vpsConfig) {
throw new Error("VPS configuration is required when creating a new VPS.");
}
// Create the VPS instance
const vpsInstance = new ovh.vps.Vps(vpsConfig.name, vpsConfig.args, vpsConfig.opts);
// Return an output that will resolve with the VPS details after creation
return vpsInstance.serviceName.apply(async (serviceName) => {
// This code runs after the VPS is created and we have the serviceName
try {
return await retrieveExistingVps(serviceName);
} catch (error) {
console.error(`Failed to retrieve VPS with name ${serviceName}:`, error);
throw error;
}
});
};
Thanks in advance!thankful-match-46035
04/09/2025, 6:05 AMthankful-match-46035
04/09/2025, 7:03 AMfull-rainbow-99384
04/09/2025, 8:59 PMthankful-match-46035
04/10/2025, 7:15 AM