github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/rds/getInstance.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 rds
     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 information about an RDS instance
    15  //
    16  // ## Example Usage
    17  //
    18  // <!--Start PulumiCodeChooser -->
    19  // ```go
    20  // package main
    21  //
    22  // import (
    23  //
    24  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/rds"
    25  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    26  //
    27  // )
    28  //
    29  //	func main() {
    30  //		pulumi.Run(func(ctx *pulumi.Context) error {
    31  //			_, err := rds.LookupInstance(ctx, &rds.LookupInstanceArgs{
    32  //				DbInstanceIdentifier: pulumi.StringRef("my-test-database"),
    33  //			}, nil)
    34  //			if err != nil {
    35  //				return err
    36  //			}
    37  //			return nil
    38  //		})
    39  //	}
    40  //
    41  // ```
    42  // <!--End PulumiCodeChooser -->
    43  func LookupInstance(ctx *pulumi.Context, args *LookupInstanceArgs, opts ...pulumi.InvokeOption) (*LookupInstanceResult, error) {
    44  	opts = internal.PkgInvokeDefaultOpts(opts)
    45  	var rv LookupInstanceResult
    46  	err := ctx.Invoke("aws:rds/getInstance:getInstance", args, &rv, opts...)
    47  	if err != nil {
    48  		return nil, err
    49  	}
    50  	return &rv, nil
    51  }
    52  
    53  // A collection of arguments for invoking getInstance.
    54  type LookupInstanceArgs struct {
    55  	// Name of the RDS instance.
    56  	DbInstanceIdentifier *string `pulumi:"dbInstanceIdentifier"`
    57  	// Map of tags, each pair of which must exactly match a pair on the desired instance.
    58  	Tags map[string]string `pulumi:"tags"`
    59  }
    60  
    61  // A collection of values returned by getInstance.
    62  type LookupInstanceResult struct {
    63  	// Hostname of the RDS instance. See also `endpoint` and `port`.
    64  	Address string `pulumi:"address"`
    65  	// Allocated storage size specified in gigabytes.
    66  	AllocatedStorage int `pulumi:"allocatedStorage"`
    67  	// Indicates that minor version patches are applied automatically.
    68  	AutoMinorVersionUpgrade bool `pulumi:"autoMinorVersionUpgrade"`
    69  	// Name of the Availability Zone the DB instance is located in.
    70  	AvailabilityZone string `pulumi:"availabilityZone"`
    71  	// Specifies the number of days for which automatic DB snapshots are retained.
    72  	BackupRetentionPeriod int `pulumi:"backupRetentionPeriod"`
    73  	// Identifier of the CA certificate for the DB instance.
    74  	CaCertIdentifier string `pulumi:"caCertIdentifier"`
    75  	// If the DB instance is a member of a DB cluster, contains the name of the DB cluster that the DB instance is a member of.
    76  	DbClusterIdentifier string `pulumi:"dbClusterIdentifier"`
    77  	// ARN for the DB instance.
    78  	DbInstanceArn string `pulumi:"dbInstanceArn"`
    79  	// Contains the name of the compute and memory capacity class of the DB instance.
    80  	DbInstanceClass      string `pulumi:"dbInstanceClass"`
    81  	DbInstanceIdentifier string `pulumi:"dbInstanceIdentifier"`
    82  	// Port that the DB instance listens on.
    83  	DbInstancePort int `pulumi:"dbInstancePort"`
    84  	// Contains the name of the initial database of this instance that was provided at create time, if one was specified when the DB instance was created. This same name is returned for the life of the DB instance.
    85  	DbName string `pulumi:"dbName"`
    86  	// Provides the list of DB parameter groups applied to this DB instance.
    87  	DbParameterGroups []string `pulumi:"dbParameterGroups"`
    88  	// Name of the subnet group associated with the DB instance.
    89  	DbSubnetGroup string `pulumi:"dbSubnetGroup"`
    90  	// List of log types to export to cloudwatch.
    91  	EnabledCloudwatchLogsExports []string `pulumi:"enabledCloudwatchLogsExports"`
    92  	// Connection endpoint in `address:port` format.
    93  	Endpoint string `pulumi:"endpoint"`
    94  	// Provides the name of the database engine to be used for this DB instance.
    95  	Engine string `pulumi:"engine"`
    96  	// Database engine version.
    97  	EngineVersion string `pulumi:"engineVersion"`
    98  	// Canonical hosted zone ID of the DB instance (to be used in a Route 53 Alias record).
    99  	HostedZoneId string `pulumi:"hostedZoneId"`
   100  	// The provider-assigned unique ID for this managed resource.
   101  	Id string `pulumi:"id"`
   102  	// Provisioned IOPS (I/O operations per second) value.
   103  	Iops int `pulumi:"iops"`
   104  	// The Amazon Web Services KMS key identifier that is used to encrypt the secret.
   105  	KmsKeyId string `pulumi:"kmsKeyId"`
   106  	// License model information for this DB instance.
   107  	LicenseModel string `pulumi:"licenseModel"`
   108  	// Provides the master user secret. Only available when `manageMasterUserPassword` is set to true. Documented below.
   109  	MasterUserSecrets []GetInstanceMasterUserSecret `pulumi:"masterUserSecrets"`
   110  	// Contains the master username for the DB instance.
   111  	MasterUsername string `pulumi:"masterUsername"`
   112  	// The upper limit to which Amazon RDS can automatically scale the storage of the DB instance.
   113  	MaxAllocatedStorage int `pulumi:"maxAllocatedStorage"`
   114  	// Interval, in seconds, between points when Enhanced Monitoring metrics are collected for the DB instance.
   115  	MonitoringInterval int `pulumi:"monitoringInterval"`
   116  	// ARN for the IAM role that permits RDS to send Enhanced Monitoring metrics to CloudWatch Logs.
   117  	MonitoringRoleArn string `pulumi:"monitoringRoleArn"`
   118  	// If the DB instance is a Multi-AZ deployment.
   119  	MultiAz bool `pulumi:"multiAz"`
   120  	// Network type of the DB instance.
   121  	NetworkType string `pulumi:"networkType"`
   122  	// Provides the list of option group memberships for this DB instance.
   123  	OptionGroupMemberships []string `pulumi:"optionGroupMemberships"`
   124  	// Database endpoint port, primarily used by an Aurora DB cluster. For a conventional RDS DB instance, the `dbInstancePort` is typically the preferred choice.
   125  	Port int `pulumi:"port"`
   126  	// Specifies the daily time range during which automated backups are created.
   127  	PreferredBackupWindow string `pulumi:"preferredBackupWindow"`
   128  	// Specifies the weekly time range during which system maintenance can occur in UTC.
   129  	PreferredMaintenanceWindow string `pulumi:"preferredMaintenanceWindow"`
   130  	// Accessibility options for the DB instance.
   131  	PubliclyAccessible bool `pulumi:"publiclyAccessible"`
   132  	// Identifier of the source DB that this is a replica of.
   133  	ReplicateSourceDb string `pulumi:"replicateSourceDb"`
   134  	// RDS Resource ID of this instance.
   135  	ResourceId string `pulumi:"resourceId"`
   136  	// Whether the DB instance is encrypted.
   137  	StorageEncrypted bool `pulumi:"storageEncrypted"`
   138  	// Storage throughput value for the DB instance.
   139  	StorageThroughput int `pulumi:"storageThroughput"`
   140  	// Storage type associated with DB instance.
   141  	StorageType string            `pulumi:"storageType"`
   142  	Tags        map[string]string `pulumi:"tags"`
   143  	// Time zone of the DB instance.
   144  	Timezone string `pulumi:"timezone"`
   145  	// Provides a list of VPC security group elements that the DB instance belongs to.
   146  	VpcSecurityGroups []string `pulumi:"vpcSecurityGroups"`
   147  }
   148  
   149  func LookupInstanceOutput(ctx *pulumi.Context, args LookupInstanceOutputArgs, opts ...pulumi.InvokeOption) LookupInstanceResultOutput {
   150  	return pulumi.ToOutputWithContext(context.Background(), args).
   151  		ApplyT(func(v interface{}) (LookupInstanceResult, error) {
   152  			args := v.(LookupInstanceArgs)
   153  			r, err := LookupInstance(ctx, &args, opts...)
   154  			var s LookupInstanceResult
   155  			if r != nil {
   156  				s = *r
   157  			}
   158  			return s, err
   159  		}).(LookupInstanceResultOutput)
   160  }
   161  
   162  // A collection of arguments for invoking getInstance.
   163  type LookupInstanceOutputArgs struct {
   164  	// Name of the RDS instance.
   165  	DbInstanceIdentifier pulumi.StringPtrInput `pulumi:"dbInstanceIdentifier"`
   166  	// Map of tags, each pair of which must exactly match a pair on the desired instance.
   167  	Tags pulumi.StringMapInput `pulumi:"tags"`
   168  }
   169  
   170  func (LookupInstanceOutputArgs) ElementType() reflect.Type {
   171  	return reflect.TypeOf((*LookupInstanceArgs)(nil)).Elem()
   172  }
   173  
   174  // A collection of values returned by getInstance.
   175  type LookupInstanceResultOutput struct{ *pulumi.OutputState }
   176  
   177  func (LookupInstanceResultOutput) ElementType() reflect.Type {
   178  	return reflect.TypeOf((*LookupInstanceResult)(nil)).Elem()
   179  }
   180  
   181  func (o LookupInstanceResultOutput) ToLookupInstanceResultOutput() LookupInstanceResultOutput {
   182  	return o
   183  }
   184  
   185  func (o LookupInstanceResultOutput) ToLookupInstanceResultOutputWithContext(ctx context.Context) LookupInstanceResultOutput {
   186  	return o
   187  }
   188  
   189  // Hostname of the RDS instance. See also `endpoint` and `port`.
   190  func (o LookupInstanceResultOutput) Address() pulumi.StringOutput {
   191  	return o.ApplyT(func(v LookupInstanceResult) string { return v.Address }).(pulumi.StringOutput)
   192  }
   193  
   194  // Allocated storage size specified in gigabytes.
   195  func (o LookupInstanceResultOutput) AllocatedStorage() pulumi.IntOutput {
   196  	return o.ApplyT(func(v LookupInstanceResult) int { return v.AllocatedStorage }).(pulumi.IntOutput)
   197  }
   198  
   199  // Indicates that minor version patches are applied automatically.
   200  func (o LookupInstanceResultOutput) AutoMinorVersionUpgrade() pulumi.BoolOutput {
   201  	return o.ApplyT(func(v LookupInstanceResult) bool { return v.AutoMinorVersionUpgrade }).(pulumi.BoolOutput)
   202  }
   203  
   204  // Name of the Availability Zone the DB instance is located in.
   205  func (o LookupInstanceResultOutput) AvailabilityZone() pulumi.StringOutput {
   206  	return o.ApplyT(func(v LookupInstanceResult) string { return v.AvailabilityZone }).(pulumi.StringOutput)
   207  }
   208  
   209  // Specifies the number of days for which automatic DB snapshots are retained.
   210  func (o LookupInstanceResultOutput) BackupRetentionPeriod() pulumi.IntOutput {
   211  	return o.ApplyT(func(v LookupInstanceResult) int { return v.BackupRetentionPeriod }).(pulumi.IntOutput)
   212  }
   213  
   214  // Identifier of the CA certificate for the DB instance.
   215  func (o LookupInstanceResultOutput) CaCertIdentifier() pulumi.StringOutput {
   216  	return o.ApplyT(func(v LookupInstanceResult) string { return v.CaCertIdentifier }).(pulumi.StringOutput)
   217  }
   218  
   219  // If the DB instance is a member of a DB cluster, contains the name of the DB cluster that the DB instance is a member of.
   220  func (o LookupInstanceResultOutput) DbClusterIdentifier() pulumi.StringOutput {
   221  	return o.ApplyT(func(v LookupInstanceResult) string { return v.DbClusterIdentifier }).(pulumi.StringOutput)
   222  }
   223  
   224  // ARN for the DB instance.
   225  func (o LookupInstanceResultOutput) DbInstanceArn() pulumi.StringOutput {
   226  	return o.ApplyT(func(v LookupInstanceResult) string { return v.DbInstanceArn }).(pulumi.StringOutput)
   227  }
   228  
   229  // Contains the name of the compute and memory capacity class of the DB instance.
   230  func (o LookupInstanceResultOutput) DbInstanceClass() pulumi.StringOutput {
   231  	return o.ApplyT(func(v LookupInstanceResult) string { return v.DbInstanceClass }).(pulumi.StringOutput)
   232  }
   233  
   234  func (o LookupInstanceResultOutput) DbInstanceIdentifier() pulumi.StringOutput {
   235  	return o.ApplyT(func(v LookupInstanceResult) string { return v.DbInstanceIdentifier }).(pulumi.StringOutput)
   236  }
   237  
   238  // Port that the DB instance listens on.
   239  func (o LookupInstanceResultOutput) DbInstancePort() pulumi.IntOutput {
   240  	return o.ApplyT(func(v LookupInstanceResult) int { return v.DbInstancePort }).(pulumi.IntOutput)
   241  }
   242  
   243  // Contains the name of the initial database of this instance that was provided at create time, if one was specified when the DB instance was created. This same name is returned for the life of the DB instance.
   244  func (o LookupInstanceResultOutput) DbName() pulumi.StringOutput {
   245  	return o.ApplyT(func(v LookupInstanceResult) string { return v.DbName }).(pulumi.StringOutput)
   246  }
   247  
   248  // Provides the list of DB parameter groups applied to this DB instance.
   249  func (o LookupInstanceResultOutput) DbParameterGroups() pulumi.StringArrayOutput {
   250  	return o.ApplyT(func(v LookupInstanceResult) []string { return v.DbParameterGroups }).(pulumi.StringArrayOutput)
   251  }
   252  
   253  // Name of the subnet group associated with the DB instance.
   254  func (o LookupInstanceResultOutput) DbSubnetGroup() pulumi.StringOutput {
   255  	return o.ApplyT(func(v LookupInstanceResult) string { return v.DbSubnetGroup }).(pulumi.StringOutput)
   256  }
   257  
   258  // List of log types to export to cloudwatch.
   259  func (o LookupInstanceResultOutput) EnabledCloudwatchLogsExports() pulumi.StringArrayOutput {
   260  	return o.ApplyT(func(v LookupInstanceResult) []string { return v.EnabledCloudwatchLogsExports }).(pulumi.StringArrayOutput)
   261  }
   262  
   263  // Connection endpoint in `address:port` format.
   264  func (o LookupInstanceResultOutput) Endpoint() pulumi.StringOutput {
   265  	return o.ApplyT(func(v LookupInstanceResult) string { return v.Endpoint }).(pulumi.StringOutput)
   266  }
   267  
   268  // Provides the name of the database engine to be used for this DB instance.
   269  func (o LookupInstanceResultOutput) Engine() pulumi.StringOutput {
   270  	return o.ApplyT(func(v LookupInstanceResult) string { return v.Engine }).(pulumi.StringOutput)
   271  }
   272  
   273  // Database engine version.
   274  func (o LookupInstanceResultOutput) EngineVersion() pulumi.StringOutput {
   275  	return o.ApplyT(func(v LookupInstanceResult) string { return v.EngineVersion }).(pulumi.StringOutput)
   276  }
   277  
   278  // Canonical hosted zone ID of the DB instance (to be used in a Route 53 Alias record).
   279  func (o LookupInstanceResultOutput) HostedZoneId() pulumi.StringOutput {
   280  	return o.ApplyT(func(v LookupInstanceResult) string { return v.HostedZoneId }).(pulumi.StringOutput)
   281  }
   282  
   283  // The provider-assigned unique ID for this managed resource.
   284  func (o LookupInstanceResultOutput) Id() pulumi.StringOutput {
   285  	return o.ApplyT(func(v LookupInstanceResult) string { return v.Id }).(pulumi.StringOutput)
   286  }
   287  
   288  // Provisioned IOPS (I/O operations per second) value.
   289  func (o LookupInstanceResultOutput) Iops() pulumi.IntOutput {
   290  	return o.ApplyT(func(v LookupInstanceResult) int { return v.Iops }).(pulumi.IntOutput)
   291  }
   292  
   293  // The Amazon Web Services KMS key identifier that is used to encrypt the secret.
   294  func (o LookupInstanceResultOutput) KmsKeyId() pulumi.StringOutput {
   295  	return o.ApplyT(func(v LookupInstanceResult) string { return v.KmsKeyId }).(pulumi.StringOutput)
   296  }
   297  
   298  // License model information for this DB instance.
   299  func (o LookupInstanceResultOutput) LicenseModel() pulumi.StringOutput {
   300  	return o.ApplyT(func(v LookupInstanceResult) string { return v.LicenseModel }).(pulumi.StringOutput)
   301  }
   302  
   303  // Provides the master user secret. Only available when `manageMasterUserPassword` is set to true. Documented below.
   304  func (o LookupInstanceResultOutput) MasterUserSecrets() GetInstanceMasterUserSecretArrayOutput {
   305  	return o.ApplyT(func(v LookupInstanceResult) []GetInstanceMasterUserSecret { return v.MasterUserSecrets }).(GetInstanceMasterUserSecretArrayOutput)
   306  }
   307  
   308  // Contains the master username for the DB instance.
   309  func (o LookupInstanceResultOutput) MasterUsername() pulumi.StringOutput {
   310  	return o.ApplyT(func(v LookupInstanceResult) string { return v.MasterUsername }).(pulumi.StringOutput)
   311  }
   312  
   313  // The upper limit to which Amazon RDS can automatically scale the storage of the DB instance.
   314  func (o LookupInstanceResultOutput) MaxAllocatedStorage() pulumi.IntOutput {
   315  	return o.ApplyT(func(v LookupInstanceResult) int { return v.MaxAllocatedStorage }).(pulumi.IntOutput)
   316  }
   317  
   318  // Interval, in seconds, between points when Enhanced Monitoring metrics are collected for the DB instance.
   319  func (o LookupInstanceResultOutput) MonitoringInterval() pulumi.IntOutput {
   320  	return o.ApplyT(func(v LookupInstanceResult) int { return v.MonitoringInterval }).(pulumi.IntOutput)
   321  }
   322  
   323  // ARN for the IAM role that permits RDS to send Enhanced Monitoring metrics to CloudWatch Logs.
   324  func (o LookupInstanceResultOutput) MonitoringRoleArn() pulumi.StringOutput {
   325  	return o.ApplyT(func(v LookupInstanceResult) string { return v.MonitoringRoleArn }).(pulumi.StringOutput)
   326  }
   327  
   328  // If the DB instance is a Multi-AZ deployment.
   329  func (o LookupInstanceResultOutput) MultiAz() pulumi.BoolOutput {
   330  	return o.ApplyT(func(v LookupInstanceResult) bool { return v.MultiAz }).(pulumi.BoolOutput)
   331  }
   332  
   333  // Network type of the DB instance.
   334  func (o LookupInstanceResultOutput) NetworkType() pulumi.StringOutput {
   335  	return o.ApplyT(func(v LookupInstanceResult) string { return v.NetworkType }).(pulumi.StringOutput)
   336  }
   337  
   338  // Provides the list of option group memberships for this DB instance.
   339  func (o LookupInstanceResultOutput) OptionGroupMemberships() pulumi.StringArrayOutput {
   340  	return o.ApplyT(func(v LookupInstanceResult) []string { return v.OptionGroupMemberships }).(pulumi.StringArrayOutput)
   341  }
   342  
   343  // Database endpoint port, primarily used by an Aurora DB cluster. For a conventional RDS DB instance, the `dbInstancePort` is typically the preferred choice.
   344  func (o LookupInstanceResultOutput) Port() pulumi.IntOutput {
   345  	return o.ApplyT(func(v LookupInstanceResult) int { return v.Port }).(pulumi.IntOutput)
   346  }
   347  
   348  // Specifies the daily time range during which automated backups are created.
   349  func (o LookupInstanceResultOutput) PreferredBackupWindow() pulumi.StringOutput {
   350  	return o.ApplyT(func(v LookupInstanceResult) string { return v.PreferredBackupWindow }).(pulumi.StringOutput)
   351  }
   352  
   353  // Specifies the weekly time range during which system maintenance can occur in UTC.
   354  func (o LookupInstanceResultOutput) PreferredMaintenanceWindow() pulumi.StringOutput {
   355  	return o.ApplyT(func(v LookupInstanceResult) string { return v.PreferredMaintenanceWindow }).(pulumi.StringOutput)
   356  }
   357  
   358  // Accessibility options for the DB instance.
   359  func (o LookupInstanceResultOutput) PubliclyAccessible() pulumi.BoolOutput {
   360  	return o.ApplyT(func(v LookupInstanceResult) bool { return v.PubliclyAccessible }).(pulumi.BoolOutput)
   361  }
   362  
   363  // Identifier of the source DB that this is a replica of.
   364  func (o LookupInstanceResultOutput) ReplicateSourceDb() pulumi.StringOutput {
   365  	return o.ApplyT(func(v LookupInstanceResult) string { return v.ReplicateSourceDb }).(pulumi.StringOutput)
   366  }
   367  
   368  // RDS Resource ID of this instance.
   369  func (o LookupInstanceResultOutput) ResourceId() pulumi.StringOutput {
   370  	return o.ApplyT(func(v LookupInstanceResult) string { return v.ResourceId }).(pulumi.StringOutput)
   371  }
   372  
   373  // Whether the DB instance is encrypted.
   374  func (o LookupInstanceResultOutput) StorageEncrypted() pulumi.BoolOutput {
   375  	return o.ApplyT(func(v LookupInstanceResult) bool { return v.StorageEncrypted }).(pulumi.BoolOutput)
   376  }
   377  
   378  // Storage throughput value for the DB instance.
   379  func (o LookupInstanceResultOutput) StorageThroughput() pulumi.IntOutput {
   380  	return o.ApplyT(func(v LookupInstanceResult) int { return v.StorageThroughput }).(pulumi.IntOutput)
   381  }
   382  
   383  // Storage type associated with DB instance.
   384  func (o LookupInstanceResultOutput) StorageType() pulumi.StringOutput {
   385  	return o.ApplyT(func(v LookupInstanceResult) string { return v.StorageType }).(pulumi.StringOutput)
   386  }
   387  
   388  func (o LookupInstanceResultOutput) Tags() pulumi.StringMapOutput {
   389  	return o.ApplyT(func(v LookupInstanceResult) map[string]string { return v.Tags }).(pulumi.StringMapOutput)
   390  }
   391  
   392  // Time zone of the DB instance.
   393  func (o LookupInstanceResultOutput) Timezone() pulumi.StringOutput {
   394  	return o.ApplyT(func(v LookupInstanceResult) string { return v.Timezone }).(pulumi.StringOutput)
   395  }
   396  
   397  // Provides a list of VPC security group elements that the DB instance belongs to.
   398  func (o LookupInstanceResultOutput) VpcSecurityGroups() pulumi.StringArrayOutput {
   399  	return o.ApplyT(func(v LookupInstanceResult) []string { return v.VpcSecurityGroups }).(pulumi.StringArrayOutput)
   400  }
   401  
   402  func init() {
   403  	pulumi.RegisterOutputType(LookupInstanceResultOutput{})
   404  }