OVHCloud v1.1.0 published on Thursday, Nov 21, 2024 by OVHcloud
ovh.CloudProject.getUserS3Credential
Explore with Pulumi AI
Use this data source to retrieve the Secret Access Key of an Access Key ID associated with a public cloud project’s user.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as ovh from "@pulumi/ovh";
const projectUsers = ovh.CloudProject.getUsers({
serviceName: "XXX",
});
// Get the user ID of a previously created user with the description "S3-User"
const users = projectUsers.then(projectUsers => .filter(user => user.description == "S3-User").map(user => (user.userId)));
const s3UserId = users[0];
const myS3Credentials = Promise.all([projectUsers, s3UserId]).then(([projectUsers, s3UserId]) => ovh.CloudProject.getUserS3Credentials({
serviceName: projectUsers.serviceName,
userId: s3UserId,
}));
const myS3Credential = Promise.all([myS3Credentials, myS3Credentials, myS3Credentials]).then(([myS3Credentials, myS3Credentials1, myS3Credentials2]) => ovh.CloudProject.getUserS3Credential({
serviceName: myS3Credentials.serviceName,
userId: myS3Credentials1.userId,
accessKeyId: myS3Credentials2.accessKeyIds?.[0],
}));
export const myAccessKeyId = myS3Credential.then(myS3Credential => myS3Credential.accessKeyId);
export const mySecretAccessKey = myS3Credential.then(myS3Credential => myS3Credential.secretAccessKey);
import pulumi
import pulumi_ovh as ovh
project_users = ovh.CloudProject.get_users(service_name="XXX")
# Get the user ID of a previously created user with the description "S3-User"
users = [user.user_id for user in project_users.users if user.description == "S3-User"]
s3_user_id = users[0]
my_s3_credentials = ovh.CloudProject.get_user_s3_credentials(service_name=project_users.service_name,
user_id=s3_user_id)
my_s3_credential = ovh.CloudProject.get_user_s3_credential(service_name=my_s3_credentials.service_name,
user_id=my_s3_credentials.user_id,
access_key_id=my_s3_credentials.access_key_ids[0])
pulumi.export("myAccessKeyId", my_s3_credential.access_key_id)
pulumi.export("mySecretAccessKey", my_s3_credential.secret_access_key)
package main
import (
"github.com/ovh/pulumi-ovh/sdk/go/ovh/CloudProject"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
projectUsers, err := CloudProject.GetUsers(ctx, &cloudproject.GetUsersArgs{
ServiceName: "XXX",
}, nil)
if err != nil {
return err
}
// Get the user ID of a previously created user with the description "S3-User"
users := "TODO: For expression"
s3UserId := users[0]
myS3Credentials, err := CloudProject.GetUserS3Credentials(ctx, &cloudproject.GetUserS3CredentialsArgs{
ServiceName: projectUsers.ServiceName,
UserId: s3UserId,
}, nil)
if err != nil {
return err
}
myS3Credential, err := CloudProject.GetUserS3Credential(ctx, &cloudproject.GetUserS3CredentialArgs{
ServiceName: myS3Credentials.ServiceName,
UserId: myS3Credentials.UserId,
AccessKeyId: myS3Credentials.AccessKeyIds[0],
}, nil)
if err != nil {
return err
}
ctx.Export("myAccessKeyId", myS3Credential.AccessKeyId)
ctx.Export("mySecretAccessKey", myS3Credential.SecretAccessKey)
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Ovh = Pulumi.Ovh;
return await Deployment.RunAsync(() =>
{
var projectUsers = Ovh.CloudProject.GetUsers.Invoke(new()
{
ServiceName = "XXX",
});
// Get the user ID of a previously created user with the description "S3-User"
var users = .Where(user => user.Description == "S3-User").Select(user =>
{
return user.UserId;
}).ToList();
var s3UserId = users[0];
var myS3Credentials = Ovh.CloudProject.GetUserS3Credentials.Invoke(new()
{
ServiceName = projectUsers.Apply(getUsersResult => getUsersResult.ServiceName),
UserId = s3UserId,
});
var myS3Credential = Ovh.CloudProject.GetUserS3Credential.Invoke(new()
{
ServiceName = myS3Credentials.Apply(getUserS3CredentialsResult => getUserS3CredentialsResult.ServiceName),
UserId = myS3Credentials.Apply(getUserS3CredentialsResult => getUserS3CredentialsResult.UserId),
AccessKeyId = myS3Credentials.Apply(getUserS3CredentialsResult => getUserS3CredentialsResult.AccessKeyIds[0]),
});
return new Dictionary<string, object?>
{
["myAccessKeyId"] = myS3Credential.Apply(getUserS3CredentialResult => getUserS3CredentialResult.AccessKeyId),
["mySecretAccessKey"] = myS3Credential.Apply(getUserS3CredentialResult => getUserS3CredentialResult.SecretAccessKey),
};
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.ovh.CloudProject.CloudProjectFunctions;
import com.pulumi.ovh.CloudProject.inputs.GetUsersArgs;
import com.pulumi.ovh.CloudProject.inputs.GetUserS3CredentialsArgs;
import com.pulumi.ovh.CloudProject.inputs.GetUserS3CredentialArgs;
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 projectUsers = CloudProjectFunctions.getUsers(GetUsersArgs.builder()
.serviceName("XXX")
.build());
// Get the user ID of a previously created user with the description "S3-User"
final var users = "TODO: ForExpression";
final var s3UserId = users[0];
final var myS3Credentials = CloudProjectFunctions.getUserS3Credentials(GetUserS3CredentialsArgs.builder()
.serviceName(projectUsers.applyValue(getUsersResult -> getUsersResult.serviceName()))
.userId(s3UserId)
.build());
final var myS3Credential = CloudProjectFunctions.getUserS3Credential(GetUserS3CredentialArgs.builder()
.serviceName(myS3Credentials.applyValue(getUserS3CredentialsResult -> getUserS3CredentialsResult.serviceName()))
.userId(myS3Credentials.applyValue(getUserS3CredentialsResult -> getUserS3CredentialsResult.userId()))
.accessKeyId(myS3Credentials.applyValue(getUserS3CredentialsResult -> getUserS3CredentialsResult.accessKeyIds()[0]))
.build());
ctx.export("myAccessKeyId", myS3Credential.applyValue(getUserS3CredentialResult -> getUserS3CredentialResult.accessKeyId()));
ctx.export("mySecretAccessKey", myS3Credential.applyValue(getUserS3CredentialResult -> getUserS3CredentialResult.secretAccessKey()));
}
}
Coming soon!
Using getUserS3Credential
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getUserS3Credential(args: GetUserS3CredentialArgs, opts?: InvokeOptions): Promise<GetUserS3CredentialResult>
function getUserS3CredentialOutput(args: GetUserS3CredentialOutputArgs, opts?: InvokeOptions): Output<GetUserS3CredentialResult>
def get_user_s3_credential(access_key_id: Optional[str] = None,
service_name: Optional[str] = None,
user_id: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetUserS3CredentialResult
def get_user_s3_credential_output(access_key_id: Optional[pulumi.Input[str]] = None,
service_name: Optional[pulumi.Input[str]] = None,
user_id: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetUserS3CredentialResult]
func GetUserS3Credential(ctx *Context, args *GetUserS3CredentialArgs, opts ...InvokeOption) (*GetUserS3CredentialResult, error)
func GetUserS3CredentialOutput(ctx *Context, args *GetUserS3CredentialOutputArgs, opts ...InvokeOption) GetUserS3CredentialResultOutput
> Note: This function is named GetUserS3Credential
in the Go SDK.
public static class GetUserS3Credential
{
public static Task<GetUserS3CredentialResult> InvokeAsync(GetUserS3CredentialArgs args, InvokeOptions? opts = null)
public static Output<GetUserS3CredentialResult> Invoke(GetUserS3CredentialInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetUserS3CredentialResult> getUserS3Credential(GetUserS3CredentialArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: ovh:CloudProject/getUserS3Credential:getUserS3Credential
arguments:
# arguments dictionary
The following arguments are supported:
- Access
Key stringId - the Access Key ID
- Service
Name string - The ID of the public cloud project. If omitted,
the
OVH_CLOUD_PROJECT_SERVICE
environment variable is used. - User
Id string - The ID of a public cloud project's user.
- Access
Key stringId - the Access Key ID
- Service
Name string - The ID of the public cloud project. If omitted,
the
OVH_CLOUD_PROJECT_SERVICE
environment variable is used. - User
Id string - The ID of a public cloud project's user.
- access
Key StringId - the Access Key ID
- service
Name String - The ID of the public cloud project. If omitted,
the
OVH_CLOUD_PROJECT_SERVICE
environment variable is used. - user
Id String - The ID of a public cloud project's user.
- access
Key stringId - the Access Key ID
- service
Name string - The ID of the public cloud project. If omitted,
the
OVH_CLOUD_PROJECT_SERVICE
environment variable is used. - user
Id string - The ID of a public cloud project's user.
- access_
key_ strid - the Access Key ID
- service_
name str - The ID of the public cloud project. If omitted,
the
OVH_CLOUD_PROJECT_SERVICE
environment variable is used. - user_
id str - The ID of a public cloud project's user.
- access
Key StringId - the Access Key ID
- service
Name String - The ID of the public cloud project. If omitted,
the
OVH_CLOUD_PROJECT_SERVICE
environment variable is used. - user
Id String - The ID of a public cloud project's user.
getUserS3Credential Result
The following output properties are available:
- Access
Key stringId - Id string
- The provider-assigned unique ID for this managed resource.
- Secret
Access stringKey - (Sensitive) the Secret Access Key
- Service
Name string - User
Id string
- Access
Key stringId - Id string
- The provider-assigned unique ID for this managed resource.
- Secret
Access stringKey - (Sensitive) the Secret Access Key
- Service
Name string - User
Id string
- access
Key StringId - id String
- The provider-assigned unique ID for this managed resource.
- secret
Access StringKey - (Sensitive) the Secret Access Key
- service
Name String - user
Id String
- access
Key stringId - id string
- The provider-assigned unique ID for this managed resource.
- secret
Access stringKey - (Sensitive) the Secret Access Key
- service
Name string - user
Id string
- access_
key_ strid - id str
- The provider-assigned unique ID for this managed resource.
- secret_
access_ strkey - (Sensitive) the Secret Access Key
- service_
name str - user_
id str
- access
Key StringId - id String
- The provider-assigned unique ID for this managed resource.
- secret
Access StringKey - (Sensitive) the Secret Access Key
- service
Name String - user
Id String
Package Details
- Repository
- ovh ovh/pulumi-ovh
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
ovh
Terraform Provider.