github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/apprunner/getHostedZoneId.go (about)

     1  // Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
     2  // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
     3  
     4  package apprunner
     5  
     6  import (
     7  	"context"
     8  	"reflect"
     9  
    10  	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
    11  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    12  )
    13  
    14  // Use this data source to get the HostedZoneId of an AWS App Runner service deployed
    15  // in a given region for the purpose of using it in an AWS Route53 Alias record.
    16  //
    17  // ## Example Usage
    18  //
    19  // <!--Start PulumiCodeChooser -->
    20  // ```go
    21  // package main
    22  //
    23  // import (
    24  //
    25  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apprunner"
    26  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/route53"
    27  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    28  //
    29  // )
    30  //
    31  //	func main() {
    32  //		pulumi.Run(func(ctx *pulumi.Context) error {
    33  //			main, err := apprunner.GetHostedZoneId(ctx, nil, nil)
    34  //			if err != nil {
    35  //				return err
    36  //			}
    37  //			_, err = route53.NewRecord(ctx, "www", &route53.RecordArgs{
    38  //				ZoneId: pulumi.Any(primary.ZoneId),
    39  //				Name:   pulumi.String("example.com"),
    40  //				Type:   pulumi.String(route53.RecordTypeA),
    41  //				Aliases: route53.RecordAliasArray{
    42  //					&route53.RecordAliasArgs{
    43  //						Name:                 pulumi.Any(mainAwsApprunnerCustomDomainAssociation.DnsTarget),
    44  //						ZoneId:               pulumi.String(main.Id),
    45  //						EvaluateTargetHealth: pulumi.Bool(true),
    46  //					},
    47  //				},
    48  //			})
    49  //			if err != nil {
    50  //				return err
    51  //			}
    52  //			return nil
    53  //		})
    54  //	}
    55  //
    56  // ```
    57  // <!--End PulumiCodeChooser -->
    58  func GetHostedZoneId(ctx *pulumi.Context, args *GetHostedZoneIdArgs, opts ...pulumi.InvokeOption) (*GetHostedZoneIdResult, error) {
    59  	opts = internal.PkgInvokeDefaultOpts(opts)
    60  	var rv GetHostedZoneIdResult
    61  	err := ctx.Invoke("aws:apprunner/getHostedZoneId:getHostedZoneId", args, &rv, opts...)
    62  	if err != nil {
    63  		return nil, err
    64  	}
    65  	return &rv, nil
    66  }
    67  
    68  // A collection of arguments for invoking getHostedZoneId.
    69  type GetHostedZoneIdArgs struct {
    70  	// Name of the region whose AWS App Runner service HostedZoneId is desired.
    71  	// Defaults to the region from the AWS provider configuration.
    72  	Region *string `pulumi:"region"`
    73  }
    74  
    75  // A collection of values returned by getHostedZoneId.
    76  type GetHostedZoneIdResult struct {
    77  	// ID of the AWS App Runner service HostedZoneId in the selected region.
    78  	Id     string `pulumi:"id"`
    79  	Region string `pulumi:"region"`
    80  }
    81  
    82  func GetHostedZoneIdOutput(ctx *pulumi.Context, args GetHostedZoneIdOutputArgs, opts ...pulumi.InvokeOption) GetHostedZoneIdResultOutput {
    83  	return pulumi.ToOutputWithContext(context.Background(), args).
    84  		ApplyT(func(v interface{}) (GetHostedZoneIdResult, error) {
    85  			args := v.(GetHostedZoneIdArgs)
    86  			r, err := GetHostedZoneId(ctx, &args, opts...)
    87  			var s GetHostedZoneIdResult
    88  			if r != nil {
    89  				s = *r
    90  			}
    91  			return s, err
    92  		}).(GetHostedZoneIdResultOutput)
    93  }
    94  
    95  // A collection of arguments for invoking getHostedZoneId.
    96  type GetHostedZoneIdOutputArgs struct {
    97  	// Name of the region whose AWS App Runner service HostedZoneId is desired.
    98  	// Defaults to the region from the AWS provider configuration.
    99  	Region pulumi.StringPtrInput `pulumi:"region"`
   100  }
   101  
   102  func (GetHostedZoneIdOutputArgs) ElementType() reflect.Type {
   103  	return reflect.TypeOf((*GetHostedZoneIdArgs)(nil)).Elem()
   104  }
   105  
   106  // A collection of values returned by getHostedZoneId.
   107  type GetHostedZoneIdResultOutput struct{ *pulumi.OutputState }
   108  
   109  func (GetHostedZoneIdResultOutput) ElementType() reflect.Type {
   110  	return reflect.TypeOf((*GetHostedZoneIdResult)(nil)).Elem()
   111  }
   112  
   113  func (o GetHostedZoneIdResultOutput) ToGetHostedZoneIdResultOutput() GetHostedZoneIdResultOutput {
   114  	return o
   115  }
   116  
   117  func (o GetHostedZoneIdResultOutput) ToGetHostedZoneIdResultOutputWithContext(ctx context.Context) GetHostedZoneIdResultOutput {
   118  	return o
   119  }
   120  
   121  // ID of the AWS App Runner service HostedZoneId in the selected region.
   122  func (o GetHostedZoneIdResultOutput) Id() pulumi.StringOutput {
   123  	return o.ApplyT(func(v GetHostedZoneIdResult) string { return v.Id }).(pulumi.StringOutput)
   124  }
   125  
   126  func (o GetHostedZoneIdResultOutput) Region() pulumi.StringOutput {
   127  	return o.ApplyT(func(v GetHostedZoneIdResult) string { return v.Region }).(pulumi.StringOutput)
   128  }
   129  
   130  func init() {
   131  	pulumi.RegisterOutputType(GetHostedZoneIdResultOutput{})
   132  }