AWS v6.54.0 published on Friday, Sep 27, 2024 by Pulumi
aws.getServicePrincipal
Explore with Pulumi AI
Use this data source to create a Service Principal Name for a service in a given region. Service Principal Names should always end in the standard global format: {servicename}.amazonaws.com
. However, in some AWS partitions, AWS may expect a different format.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const current = aws.getServicePrincipal({
serviceName: "s3",
});
const test = aws.getServicePrincipal({
serviceName: "s3",
region: "us-iso-east-1",
});
import pulumi
import pulumi_aws as aws
current = aws.get_service_principal(service_name="s3")
test = aws.get_service_principal(service_name="s3",
region="us-iso-east-1")
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := aws.GetServicePrincipal(ctx, &aws.GetServicePrincipalArgs{
ServiceName: "s3",
}, nil)
if err != nil {
return err
}
_, err = aws.GetServicePrincipal(ctx, &aws.GetServicePrincipalArgs{
ServiceName: "s3",
Region: pulumi.StringRef("us-iso-east-1"),
}, nil)
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var current = Aws.GetServicePrincipal.Invoke(new()
{
ServiceName = "s3",
});
var test = Aws.GetServicePrincipal.Invoke(new()
{
ServiceName = "s3",
Region = "us-iso-east-1",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.AwsFunctions;
import com.pulumi.aws.inputs.GetServicePrincipalArgs;
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 current = AwsFunctions.getServicePrincipal(GetServicePrincipalArgs.builder()
.serviceName("s3")
.build());
final var test = AwsFunctions.getServicePrincipal(GetServicePrincipalArgs.builder()
.serviceName("s3")
.region("us-iso-east-1")
.build());
}
}
variables:
current:
fn::invoke:
Function: aws:getServicePrincipal
Arguments:
serviceName: s3
test:
fn::invoke:
Function: aws:getServicePrincipal
Arguments:
serviceName: s3
region: us-iso-east-1
Using getServicePrincipal
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 getServicePrincipal(args: GetServicePrincipalArgs, opts?: InvokeOptions): Promise<GetServicePrincipalResult>
function getServicePrincipalOutput(args: GetServicePrincipalOutputArgs, opts?: InvokeOptions): Output<GetServicePrincipalResult>
def get_service_principal(region: Optional[str] = None,
service_name: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetServicePrincipalResult
def get_service_principal_output(region: Optional[pulumi.Input[str]] = None,
service_name: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetServicePrincipalResult]
func GetServicePrincipal(ctx *Context, args *GetServicePrincipalArgs, opts ...InvokeOption) (*GetServicePrincipalResult, error)
func GetServicePrincipalOutput(ctx *Context, args *GetServicePrincipalOutputArgs, opts ...InvokeOption) GetServicePrincipalResultOutput
> Note: This function is named GetServicePrincipal
in the Go SDK.
public static class GetServicePrincipal
{
public static Task<GetServicePrincipalResult> InvokeAsync(GetServicePrincipalArgs args, InvokeOptions? opts = null)
public static Output<GetServicePrincipalResult> Invoke(GetServicePrincipalInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetServicePrincipalResult> getServicePrincipal(GetServicePrincipalArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: aws:index/getServicePrincipal:getServicePrincipal
arguments:
# arguments dictionary
The following arguments are supported:
- Service
Name string - Name of the service you want to generate a Service Principal Name for.
- Region string
- Region you'd like the SPN for. By default, uses the current region.
- Service
Name string - Name of the service you want to generate a Service Principal Name for.
- Region string
- Region you'd like the SPN for. By default, uses the current region.
- service
Name String - Name of the service you want to generate a Service Principal Name for.
- region String
- Region you'd like the SPN for. By default, uses the current region.
- service
Name string - Name of the service you want to generate a Service Principal Name for.
- region string
- Region you'd like the SPN for. By default, uses the current region.
- service_
name str - Name of the service you want to generate a Service Principal Name for.
- region str
- Region you'd like the SPN for. By default, uses the current region.
- service
Name String - Name of the service you want to generate a Service Principal Name for.
- region String
- Region you'd like the SPN for. By default, uses the current region.
getServicePrincipal Result
The following output properties are available:
- Id string
- Identifier of the current Service Principal (compound of service, region and suffix). (e.g.
logs.us-east-1.amazonaws.com
in AWS Commercial,logs.cn-north-1.amazonaws.com.cn
in AWS China). - Name string
- Service Principal Name (e.g.,
logs.amazonaws.com
in AWS Commercial,logs.amazonaws.com.cn
in AWS China). - Region string
- Region identifier of the generated SPN (e.g.,
us-east-1
in AWS Commercial,cn-north-1
in AWS China). - Service
Name string - Suffix string
- Suffix of the SPN (e.g.,
amazonaws.com
in AWS Commercial,amazonaws.com.cn
in AWS China).
- Id string
- Identifier of the current Service Principal (compound of service, region and suffix). (e.g.
logs.us-east-1.amazonaws.com
in AWS Commercial,logs.cn-north-1.amazonaws.com.cn
in AWS China). - Name string
- Service Principal Name (e.g.,
logs.amazonaws.com
in AWS Commercial,logs.amazonaws.com.cn
in AWS China). - Region string
- Region identifier of the generated SPN (e.g.,
us-east-1
in AWS Commercial,cn-north-1
in AWS China). - Service
Name string - Suffix string
- Suffix of the SPN (e.g.,
amazonaws.com
in AWS Commercial,amazonaws.com.cn
in AWS China).
- id String
- Identifier of the current Service Principal (compound of service, region and suffix). (e.g.
logs.us-east-1.amazonaws.com
in AWS Commercial,logs.cn-north-1.amazonaws.com.cn
in AWS China). - name String
- Service Principal Name (e.g.,
logs.amazonaws.com
in AWS Commercial,logs.amazonaws.com.cn
in AWS China). - region String
- Region identifier of the generated SPN (e.g.,
us-east-1
in AWS Commercial,cn-north-1
in AWS China). - service
Name String - suffix String
- Suffix of the SPN (e.g.,
amazonaws.com
in AWS Commercial,amazonaws.com.cn
in AWS China).
- id string
- Identifier of the current Service Principal (compound of service, region and suffix). (e.g.
logs.us-east-1.amazonaws.com
in AWS Commercial,logs.cn-north-1.amazonaws.com.cn
in AWS China). - name string
- Service Principal Name (e.g.,
logs.amazonaws.com
in AWS Commercial,logs.amazonaws.com.cn
in AWS China). - region string
- Region identifier of the generated SPN (e.g.,
us-east-1
in AWS Commercial,cn-north-1
in AWS China). - service
Name string - suffix string
- Suffix of the SPN (e.g.,
amazonaws.com
in AWS Commercial,amazonaws.com.cn
in AWS China).
- id str
- Identifier of the current Service Principal (compound of service, region and suffix). (e.g.
logs.us-east-1.amazonaws.com
in AWS Commercial,logs.cn-north-1.amazonaws.com.cn
in AWS China). - name str
- Service Principal Name (e.g.,
logs.amazonaws.com
in AWS Commercial,logs.amazonaws.com.cn
in AWS China). - region str
- Region identifier of the generated SPN (e.g.,
us-east-1
in AWS Commercial,cn-north-1
in AWS China). - service_
name str - suffix str
- Suffix of the SPN (e.g.,
amazonaws.com
in AWS Commercial,amazonaws.com.cn
in AWS China).
- id String
- Identifier of the current Service Principal (compound of service, region and suffix). (e.g.
logs.us-east-1.amazonaws.com
in AWS Commercial,logs.cn-north-1.amazonaws.com.cn
in AWS China). - name String
- Service Principal Name (e.g.,
logs.amazonaws.com
in AWS Commercial,logs.amazonaws.com.cn
in AWS China). - region String
- Region identifier of the generated SPN (e.g.,
us-east-1
in AWS Commercial,cn-north-1
in AWS China). - service
Name String - suffix String
- Suffix of the SPN (e.g.,
amazonaws.com
in AWS Commercial,amazonaws.com.cn
in AWS China).
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
aws
Terraform Provider.