get Key Pairs
This data source provides the Ecp Key Pairs of the current Alibaba Cloud user.
NOTE: Available in v1.130.0+.
Example Usage
Basic Usage
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.ecp.EcpFunctions;
import com.pulumi.alicloud.ecp.inputs.GetKeyPairsArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var ids = EcpFunctions.getKeyPairs();
ctx.export("ecpKeyPairId1", ids.applyValue(getKeyPairsResult -> getKeyPairsResult.pairs()[0].id()));
final var nameRegex = EcpFunctions.getKeyPairs(GetKeyPairsArgs.builder()
.nameRegex("^my-KeyPair")
.build());
ctx.export("ecpKeyPairId2", nameRegex.applyValue(getKeyPairsResult -> getKeyPairsResult.pairs()[0].id()));
}
}
Content copied to clipboard
Return
A collection of values returned by getKeyPairs.
Parameters
argument
A collection of arguments for invoking getKeyPairs.
suspend fun getKeyPairs(ids: List<String>? = null, keyPairFingerPrint: String? = null, nameRegex: String? = null, outputFile: String? = null): GetKeyPairsResult
Return
A collection of values returned by getKeyPairs.
See also
Parameters
ids
A list of Key Pair IDs. Its element value is same as Key Pair Name.
key Pair Finger Print
The Private Key of the Fingerprint.
name Regex
A regex string to filter results by Key Pair name.
output File
File name where to save data source results (after running pulumi preview
).
suspend fun getKeyPairs(argument: suspend GetKeyPairsPlainArgsBuilder.() -> Unit): GetKeyPairsResult
Return
A collection of values returned by getKeyPairs.
See also
Parameters
argument
Builder for com.pulumi.alicloud.ecp.kotlin.inputs.GetKeyPairsPlainArgs.