/
databaseInstance.go
968 lines (897 loc) · 49.5 KB
/
databaseInstance.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
// Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package sql
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Creates a new Google SQL Database Instance. For more information, see the [official documentation](https://cloud.google.com/sql/),
// or the [JSON API](https://cloud.google.com/sql/docs/admin-api/v1beta4/instances).
//
// > **NOTE on `sql.DatabaseInstance`:** - Second-generation instances include a
// default 'root'@'%' user with no password. This user will be deleted by the provider on
// instance creation. You should use `sql.User` to define a custom user with
// a restricted host and strong password.
//
// > **Note**: On newer versions of the provider, you must explicitly set `deletion_protection=false`
// (and run `pulumi update` to write the field to state) in order to destroy an instance.
// It is recommended to not set this field (or set it to true) until you're ready to destroy the instance and its databases.
//
// ## Example Usage
//
// ### SQL Second Generation Instance
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/sql"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := sql.NewDatabaseInstance(ctx, "main", &sql.DatabaseInstanceArgs{
// Name: pulumi.String("main-instance"),
// DatabaseVersion: pulumi.String("POSTGRES_15"),
// Region: pulumi.String("us-central1"),
// Settings: &sql.DatabaseInstanceSettingsArgs{
// Tier: pulumi.String("db-f1-micro"),
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
//
// ### Private IP Instance
// > **NOTE:** For private IP instance setup, note that the `sql.DatabaseInstance` does not actually interpolate values from `servicenetworking.Connection`. You must explicitly add a `dependsOn`reference as shown below.
//
// ```go
// package main
//
// import (
//
// "fmt"
//
// "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
// "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/servicenetworking"
// "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/sql"
// "github.com/pulumi/pulumi-random/sdk/v4/go/random"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// privateNetwork, err := compute.NewNetwork(ctx, "private_network", &compute.NetworkArgs{
// Name: pulumi.String("private-network"),
// })
// if err != nil {
// return err
// }
// privateIpAddress, err := compute.NewGlobalAddress(ctx, "private_ip_address", &compute.GlobalAddressArgs{
// Name: pulumi.String("private-ip-address"),
// Purpose: pulumi.String("VPC_PEERING"),
// AddressType: pulumi.String("INTERNAL"),
// PrefixLength: pulumi.Int(16),
// Network: privateNetwork.ID(),
// })
// if err != nil {
// return err
// }
// _, err = servicenetworking.NewConnection(ctx, "private_vpc_connection", &servicenetworking.ConnectionArgs{
// Network: privateNetwork.ID(),
// Service: pulumi.String("servicenetworking.googleapis.com"),
// ReservedPeeringRanges: pulumi.StringArray{
// privateIpAddress.Name,
// },
// })
// if err != nil {
// return err
// }
// dbNameSuffix, err := random.NewRandomId(ctx, "db_name_suffix", &random.RandomIdArgs{
// ByteLength: pulumi.Int(4),
// })
// if err != nil {
// return err
// }
// _, err = sql.NewDatabaseInstance(ctx, "instance", &sql.DatabaseInstanceArgs{
// Name: dbNameSuffix.Hex.ApplyT(func(hex string) (string, error) {
// return fmt.Sprintf("private-instance-%v", hex), nil
// }).(pulumi.StringOutput),
// Region: pulumi.String("us-central1"),
// DatabaseVersion: pulumi.String("MYSQL_5_7"),
// Settings: &sql.DatabaseInstanceSettingsArgs{
// Tier: pulumi.String("db-f1-micro"),
// IpConfiguration: &sql.DatabaseInstanceSettingsIpConfigurationArgs{
// Ipv4Enabled: pulumi.Bool(false),
// PrivateNetwork: privateNetwork.ID(),
// EnablePrivatePathForGoogleCloudServices: pulumi.Bool(true),
// },
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
//
// ### ENTERPRISE_PLUS Instance with dataCacheConfig
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/sql"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := sql.NewDatabaseInstance(ctx, "main", &sql.DatabaseInstanceArgs{
// Name: pulumi.String("enterprise-plus-main-instance"),
// DatabaseVersion: pulumi.String("MYSQL_8_0_31"),
// Settings: &sql.DatabaseInstanceSettingsArgs{
// Tier: pulumi.String("db-perf-optimized-N-2"),
// Edition: pulumi.String("ENTERPRISE_PLUS"),
// DataCacheConfig: &sql.DatabaseInstanceSettingsDataCacheConfigArgs{
// DataCacheEnabled: pulumi.Bool(true),
// },
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
//
// ### Cloud SQL Instance with PSC connectivity
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/sql"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := sql.NewDatabaseInstance(ctx, "main", &sql.DatabaseInstanceArgs{
// Name: pulumi.String("psc-enabled-main-instance"),
// DatabaseVersion: pulumi.String("MYSQL_8_0"),
// Settings: &sql.DatabaseInstanceSettingsArgs{
// Tier: pulumi.String("db-f1-micro"),
// IpConfiguration: &sql.DatabaseInstanceSettingsIpConfigurationArgs{
// PscConfigs: sql.DatabaseInstanceSettingsIpConfigurationPscConfigArray{
// &sql.DatabaseInstanceSettingsIpConfigurationPscConfigArgs{
// PscEnabled: pulumi.Bool(true),
// AllowedConsumerProjects: pulumi.StringArray{
// pulumi.String("allowed-consumer-project-name"),
// },
// },
// },
// Ipv4Enabled: pulumi.Bool(false),
// },
// BackupConfiguration: &sql.DatabaseInstanceSettingsBackupConfigurationArgs{
// Enabled: pulumi.Bool(true),
// BinaryLogEnabled: pulumi.Bool(true),
// },
// AvailabilityType: pulumi.String("REGIONAL"),
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
//
// ## Import
//
// Database instances can be imported using one of any of these accepted formats:
//
// * `projects/{{project}}/instances/{{name}}`
//
// * `{{project}}/{{name}}`
//
// * `{{name}}`
//
// When using the `pulumi import` command, Database instances can be imported using one of the formats above. For example:
//
// ```sh
// $ pulumi import gcp:sql/databaseInstance:DatabaseInstance default projects/{{project}}/instances/{{name}}
// ```
//
// ```sh
// $ pulumi import gcp:sql/databaseInstance:DatabaseInstance default {{project}}/{{name}}
// ```
//
// ```sh
// $ pulumi import gcp:sql/databaseInstance:DatabaseInstance default {{name}}
// ```
//
// config and set on the server.
//
// # When importing, double-check that your config has all the fields set that you expect- just seeing
//
// no diff isn't sufficient to know that your config could reproduce the imported resource.
type DatabaseInstance struct {
pulumi.CustomResourceState
// The list of all maintenance versions applicable on the instance.
AvailableMaintenanceVersions pulumi.StringArrayOutput `pulumi:"availableMaintenanceVersions"`
// The context needed to create this instance as a clone of another instance. When this field is set during
// resource creation, this provider will attempt to clone another instance as indicated in the context. The
// configuration is detailed below.
Clone DatabaseInstanceClonePtrOutput `pulumi:"clone"`
// The connection name of the instance to be used in
// connection strings. For example, when connecting with [Cloud SQL Proxy](https://cloud.google.com/sql/docs/mysql/connect-admin-proxy).
ConnectionName pulumi.StringOutput `pulumi:"connectionName"`
// The MySQL, PostgreSQL or
// SQL Server version to use. Supported values include `MYSQL_5_6`,
// `MYSQL_5_7`, `MYSQL_8_0`, `POSTGRES_9_6`,`POSTGRES_10`, `POSTGRES_11`,
// `POSTGRES_12`, `POSTGRES_13`, `POSTGRES_14`, `POSTGRES_15`, `SQLSERVER_2017_STANDARD`,
// `SQLSERVER_2017_ENTERPRISE`, `SQLSERVER_2017_EXPRESS`, `SQLSERVER_2017_WEB`.
// `SQLSERVER_2019_STANDARD`, `SQLSERVER_2019_ENTERPRISE`, `SQLSERVER_2019_EXPRESS`,
// `SQLSERVER_2019_WEB`.
// [Database Version Policies](https://cloud.google.com/sql/docs/db-versions)
// includes an up-to-date reference of supported versions.
DatabaseVersion pulumi.StringOutput `pulumi:"databaseVersion"`
// Whether or not to allow the provider to destroy the instance. Unless this field is set to false
// in state, a `destroy` or `update` command that deletes the instance will fail. Defaults to `true`.
DeletionProtection pulumi.BoolPtrOutput `pulumi:"deletionProtection"`
// The dns name of the instance.
DnsName pulumi.StringOutput `pulumi:"dnsName"`
// The full path to the encryption key used for the CMEK disk encryption. Setting
// up disk encryption currently requires manual steps outside of this provider.
// The provided key must be in the same region as the SQL instance. In order
// to use this feature, a special kind of service account must be created and
// granted permission on this key. This step can currently only be done
// manually, please see [this step](https://cloud.google.com/sql/docs/mysql/configure-cmek#service-account).
// That service account needs the `Cloud KMS > Cloud KMS CryptoKey Encrypter/Decrypter` role on your
// key - please see [this step](https://cloud.google.com/sql/docs/mysql/configure-cmek#grantkey).
EncryptionKeyName pulumi.StringOutput `pulumi:"encryptionKeyName"`
// The first IPv4 address of any type assigned.
FirstIpAddress pulumi.StringOutput `pulumi:"firstIpAddress"`
// The type of the instance. The supported values are `SQL_INSTANCE_TYPE_UNSPECIFIED`, `CLOUD_SQL_INSTANCE`, `ON_PREMISES_INSTANCE` and `READ_REPLICA_INSTANCE`.
InstanceType pulumi.StringOutput `pulumi:"instanceType"`
IpAddresses DatabaseInstanceIpAddressArrayOutput `pulumi:"ipAddresses"`
// The current software version on the instance. This attribute can not be set during creation. Refer to `availableMaintenanceVersions` attribute to see what `maintenanceVersion` are available for upgrade. When this attribute gets updated, it will cause an instance restart. Setting a `maintenanceVersion` value that is older than the current one on the instance will be ignored.
MaintenanceVersion pulumi.StringOutput `pulumi:"maintenanceVersion"`
// The name of the existing instance that will
// act as the master in the replication setup. Note, this requires the master to
// have `binaryLogEnabled` set, as well as existing backups.
MasterInstanceName pulumi.StringOutput `pulumi:"masterInstanceName"`
// The name of the instance. If the name is left
// blank, the provider will randomly generate one when the instance is first
// created. This is done because after a name is used, it cannot be reused for
// up to [one week](https://cloud.google.com/sql/docs/delete-instance).
Name pulumi.StringOutput `pulumi:"name"`
// The first private (`PRIVATE`) IPv4 address assigned.
PrivateIpAddress pulumi.StringOutput `pulumi:"privateIpAddress"`
// The ID of the project in which the resource belongs. If it
// is not provided, the provider project is used.
Project pulumi.StringOutput `pulumi:"project"`
// the URI that points to the service attachment of the instance.
PscServiceAttachmentLink pulumi.StringOutput `pulumi:"pscServiceAttachmentLink"`
// The first public (`PRIMARY`) IPv4 address assigned.
PublicIpAddress pulumi.StringOutput `pulumi:"publicIpAddress"`
// The region the instance will sit in. If a region is not provided in the resource definition,
// the provider region will be used instead.
//
// ***
Region pulumi.StringOutput `pulumi:"region"`
// The configuration for replication. The
// configuration is detailed below. Valid only for MySQL instances.
ReplicaConfiguration DatabaseInstanceReplicaConfigurationOutput `pulumi:"replicaConfiguration"`
// The context needed to restore the database to a backup run. This field will
// cause the provider to trigger the database to restore from the backup run indicated. The configuration is detailed below.
// **NOTE:** Restoring from a backup is an imperative action and not recommended via this provider. Adding or modifying this
// block during resource creation/update will trigger the restore action after the resource is created/updated.
RestoreBackupContext DatabaseInstanceRestoreBackupContextPtrOutput `pulumi:"restoreBackupContext"`
// Initial root password. Can be updated. Required for MS SQL Server.
RootPassword pulumi.StringPtrOutput `pulumi:"rootPassword"`
// The URI of the created resource.
SelfLink pulumi.StringOutput `pulumi:"selfLink"`
ServerCaCerts DatabaseInstanceServerCaCertArrayOutput `pulumi:"serverCaCerts"`
// The service account email address assigned to the
// instance.
ServiceAccountEmailAddress pulumi.StringOutput `pulumi:"serviceAccountEmailAddress"`
// The settings to use for the database. The
// configuration is detailed below. Required if `clone` is not set.
Settings DatabaseInstanceSettingsOutput `pulumi:"settings"`
}
// NewDatabaseInstance registers a new resource with the given unique name, arguments, and options.
func NewDatabaseInstance(ctx *pulumi.Context,
name string, args *DatabaseInstanceArgs, opts ...pulumi.ResourceOption) (*DatabaseInstance, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.DatabaseVersion == nil {
return nil, errors.New("invalid value for required argument 'DatabaseVersion'")
}
if args.ReplicaConfiguration != nil {
args.ReplicaConfiguration = pulumi.ToSecret(args.ReplicaConfiguration).(DatabaseInstanceReplicaConfigurationPtrInput)
}
if args.RootPassword != nil {
args.RootPassword = pulumi.ToSecret(args.RootPassword).(pulumi.StringPtrInput)
}
secrets := pulumi.AdditionalSecretOutputs([]string{
"replicaConfiguration",
"rootPassword",
"serverCaCerts",
})
opts = append(opts, secrets)
opts = internal.PkgResourceDefaultOpts(opts)
var resource DatabaseInstance
err := ctx.RegisterResource("gcp:sql/databaseInstance:DatabaseInstance", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetDatabaseInstance gets an existing DatabaseInstance resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetDatabaseInstance(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *DatabaseInstanceState, opts ...pulumi.ResourceOption) (*DatabaseInstance, error) {
var resource DatabaseInstance
err := ctx.ReadResource("gcp:sql/databaseInstance:DatabaseInstance", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering DatabaseInstance resources.
type databaseInstanceState struct {
// The list of all maintenance versions applicable on the instance.
AvailableMaintenanceVersions []string `pulumi:"availableMaintenanceVersions"`
// The context needed to create this instance as a clone of another instance. When this field is set during
// resource creation, this provider will attempt to clone another instance as indicated in the context. The
// configuration is detailed below.
Clone *DatabaseInstanceClone `pulumi:"clone"`
// The connection name of the instance to be used in
// connection strings. For example, when connecting with [Cloud SQL Proxy](https://cloud.google.com/sql/docs/mysql/connect-admin-proxy).
ConnectionName *string `pulumi:"connectionName"`
// The MySQL, PostgreSQL or
// SQL Server version to use. Supported values include `MYSQL_5_6`,
// `MYSQL_5_7`, `MYSQL_8_0`, `POSTGRES_9_6`,`POSTGRES_10`, `POSTGRES_11`,
// `POSTGRES_12`, `POSTGRES_13`, `POSTGRES_14`, `POSTGRES_15`, `SQLSERVER_2017_STANDARD`,
// `SQLSERVER_2017_ENTERPRISE`, `SQLSERVER_2017_EXPRESS`, `SQLSERVER_2017_WEB`.
// `SQLSERVER_2019_STANDARD`, `SQLSERVER_2019_ENTERPRISE`, `SQLSERVER_2019_EXPRESS`,
// `SQLSERVER_2019_WEB`.
// [Database Version Policies](https://cloud.google.com/sql/docs/db-versions)
// includes an up-to-date reference of supported versions.
DatabaseVersion *string `pulumi:"databaseVersion"`
// Whether or not to allow the provider to destroy the instance. Unless this field is set to false
// in state, a `destroy` or `update` command that deletes the instance will fail. Defaults to `true`.
DeletionProtection *bool `pulumi:"deletionProtection"`
// The dns name of the instance.
DnsName *string `pulumi:"dnsName"`
// The full path to the encryption key used for the CMEK disk encryption. Setting
// up disk encryption currently requires manual steps outside of this provider.
// The provided key must be in the same region as the SQL instance. In order
// to use this feature, a special kind of service account must be created and
// granted permission on this key. This step can currently only be done
// manually, please see [this step](https://cloud.google.com/sql/docs/mysql/configure-cmek#service-account).
// That service account needs the `Cloud KMS > Cloud KMS CryptoKey Encrypter/Decrypter` role on your
// key - please see [this step](https://cloud.google.com/sql/docs/mysql/configure-cmek#grantkey).
EncryptionKeyName *string `pulumi:"encryptionKeyName"`
// The first IPv4 address of any type assigned.
FirstIpAddress *string `pulumi:"firstIpAddress"`
// The type of the instance. The supported values are `SQL_INSTANCE_TYPE_UNSPECIFIED`, `CLOUD_SQL_INSTANCE`, `ON_PREMISES_INSTANCE` and `READ_REPLICA_INSTANCE`.
InstanceType *string `pulumi:"instanceType"`
IpAddresses []DatabaseInstanceIpAddress `pulumi:"ipAddresses"`
// The current software version on the instance. This attribute can not be set during creation. Refer to `availableMaintenanceVersions` attribute to see what `maintenanceVersion` are available for upgrade. When this attribute gets updated, it will cause an instance restart. Setting a `maintenanceVersion` value that is older than the current one on the instance will be ignored.
MaintenanceVersion *string `pulumi:"maintenanceVersion"`
// The name of the existing instance that will
// act as the master in the replication setup. Note, this requires the master to
// have `binaryLogEnabled` set, as well as existing backups.
MasterInstanceName *string `pulumi:"masterInstanceName"`
// The name of the instance. If the name is left
// blank, the provider will randomly generate one when the instance is first
// created. This is done because after a name is used, it cannot be reused for
// up to [one week](https://cloud.google.com/sql/docs/delete-instance).
Name *string `pulumi:"name"`
// The first private (`PRIVATE`) IPv4 address assigned.
PrivateIpAddress *string `pulumi:"privateIpAddress"`
// The ID of the project in which the resource belongs. If it
// is not provided, the provider project is used.
Project *string `pulumi:"project"`
// the URI that points to the service attachment of the instance.
PscServiceAttachmentLink *string `pulumi:"pscServiceAttachmentLink"`
// The first public (`PRIMARY`) IPv4 address assigned.
PublicIpAddress *string `pulumi:"publicIpAddress"`
// The region the instance will sit in. If a region is not provided in the resource definition,
// the provider region will be used instead.
//
// ***
Region *string `pulumi:"region"`
// The configuration for replication. The
// configuration is detailed below. Valid only for MySQL instances.
ReplicaConfiguration *DatabaseInstanceReplicaConfiguration `pulumi:"replicaConfiguration"`
// The context needed to restore the database to a backup run. This field will
// cause the provider to trigger the database to restore from the backup run indicated. The configuration is detailed below.
// **NOTE:** Restoring from a backup is an imperative action and not recommended via this provider. Adding or modifying this
// block during resource creation/update will trigger the restore action after the resource is created/updated.
RestoreBackupContext *DatabaseInstanceRestoreBackupContext `pulumi:"restoreBackupContext"`
// Initial root password. Can be updated. Required for MS SQL Server.
RootPassword *string `pulumi:"rootPassword"`
// The URI of the created resource.
SelfLink *string `pulumi:"selfLink"`
ServerCaCerts []DatabaseInstanceServerCaCert `pulumi:"serverCaCerts"`
// The service account email address assigned to the
// instance.
ServiceAccountEmailAddress *string `pulumi:"serviceAccountEmailAddress"`
// The settings to use for the database. The
// configuration is detailed below. Required if `clone` is not set.
Settings *DatabaseInstanceSettings `pulumi:"settings"`
}
type DatabaseInstanceState struct {
// The list of all maintenance versions applicable on the instance.
AvailableMaintenanceVersions pulumi.StringArrayInput
// The context needed to create this instance as a clone of another instance. When this field is set during
// resource creation, this provider will attempt to clone another instance as indicated in the context. The
// configuration is detailed below.
Clone DatabaseInstanceClonePtrInput
// The connection name of the instance to be used in
// connection strings. For example, when connecting with [Cloud SQL Proxy](https://cloud.google.com/sql/docs/mysql/connect-admin-proxy).
ConnectionName pulumi.StringPtrInput
// The MySQL, PostgreSQL or
// SQL Server version to use. Supported values include `MYSQL_5_6`,
// `MYSQL_5_7`, `MYSQL_8_0`, `POSTGRES_9_6`,`POSTGRES_10`, `POSTGRES_11`,
// `POSTGRES_12`, `POSTGRES_13`, `POSTGRES_14`, `POSTGRES_15`, `SQLSERVER_2017_STANDARD`,
// `SQLSERVER_2017_ENTERPRISE`, `SQLSERVER_2017_EXPRESS`, `SQLSERVER_2017_WEB`.
// `SQLSERVER_2019_STANDARD`, `SQLSERVER_2019_ENTERPRISE`, `SQLSERVER_2019_EXPRESS`,
// `SQLSERVER_2019_WEB`.
// [Database Version Policies](https://cloud.google.com/sql/docs/db-versions)
// includes an up-to-date reference of supported versions.
DatabaseVersion pulumi.StringPtrInput
// Whether or not to allow the provider to destroy the instance. Unless this field is set to false
// in state, a `destroy` or `update` command that deletes the instance will fail. Defaults to `true`.
DeletionProtection pulumi.BoolPtrInput
// The dns name of the instance.
DnsName pulumi.StringPtrInput
// The full path to the encryption key used for the CMEK disk encryption. Setting
// up disk encryption currently requires manual steps outside of this provider.
// The provided key must be in the same region as the SQL instance. In order
// to use this feature, a special kind of service account must be created and
// granted permission on this key. This step can currently only be done
// manually, please see [this step](https://cloud.google.com/sql/docs/mysql/configure-cmek#service-account).
// That service account needs the `Cloud KMS > Cloud KMS CryptoKey Encrypter/Decrypter` role on your
// key - please see [this step](https://cloud.google.com/sql/docs/mysql/configure-cmek#grantkey).
EncryptionKeyName pulumi.StringPtrInput
// The first IPv4 address of any type assigned.
FirstIpAddress pulumi.StringPtrInput
// The type of the instance. The supported values are `SQL_INSTANCE_TYPE_UNSPECIFIED`, `CLOUD_SQL_INSTANCE`, `ON_PREMISES_INSTANCE` and `READ_REPLICA_INSTANCE`.
InstanceType pulumi.StringPtrInput
IpAddresses DatabaseInstanceIpAddressArrayInput
// The current software version on the instance. This attribute can not be set during creation. Refer to `availableMaintenanceVersions` attribute to see what `maintenanceVersion` are available for upgrade. When this attribute gets updated, it will cause an instance restart. Setting a `maintenanceVersion` value that is older than the current one on the instance will be ignored.
MaintenanceVersion pulumi.StringPtrInput
// The name of the existing instance that will
// act as the master in the replication setup. Note, this requires the master to
// have `binaryLogEnabled` set, as well as existing backups.
MasterInstanceName pulumi.StringPtrInput
// The name of the instance. If the name is left
// blank, the provider will randomly generate one when the instance is first
// created. This is done because after a name is used, it cannot be reused for
// up to [one week](https://cloud.google.com/sql/docs/delete-instance).
Name pulumi.StringPtrInput
// The first private (`PRIVATE`) IPv4 address assigned.
PrivateIpAddress pulumi.StringPtrInput
// The ID of the project in which the resource belongs. If it
// is not provided, the provider project is used.
Project pulumi.StringPtrInput
// the URI that points to the service attachment of the instance.
PscServiceAttachmentLink pulumi.StringPtrInput
// The first public (`PRIMARY`) IPv4 address assigned.
PublicIpAddress pulumi.StringPtrInput
// The region the instance will sit in. If a region is not provided in the resource definition,
// the provider region will be used instead.
//
// ***
Region pulumi.StringPtrInput
// The configuration for replication. The
// configuration is detailed below. Valid only for MySQL instances.
ReplicaConfiguration DatabaseInstanceReplicaConfigurationPtrInput
// The context needed to restore the database to a backup run. This field will
// cause the provider to trigger the database to restore from the backup run indicated. The configuration is detailed below.
// **NOTE:** Restoring from a backup is an imperative action and not recommended via this provider. Adding or modifying this
// block during resource creation/update will trigger the restore action after the resource is created/updated.
RestoreBackupContext DatabaseInstanceRestoreBackupContextPtrInput
// Initial root password. Can be updated. Required for MS SQL Server.
RootPassword pulumi.StringPtrInput
// The URI of the created resource.
SelfLink pulumi.StringPtrInput
ServerCaCerts DatabaseInstanceServerCaCertArrayInput
// The service account email address assigned to the
// instance.
ServiceAccountEmailAddress pulumi.StringPtrInput
// The settings to use for the database. The
// configuration is detailed below. Required if `clone` is not set.
Settings DatabaseInstanceSettingsPtrInput
}
func (DatabaseInstanceState) ElementType() reflect.Type {
return reflect.TypeOf((*databaseInstanceState)(nil)).Elem()
}
type databaseInstanceArgs struct {
// The context needed to create this instance as a clone of another instance. When this field is set during
// resource creation, this provider will attempt to clone another instance as indicated in the context. The
// configuration is detailed below.
Clone *DatabaseInstanceClone `pulumi:"clone"`
// The MySQL, PostgreSQL or
// SQL Server version to use. Supported values include `MYSQL_5_6`,
// `MYSQL_5_7`, `MYSQL_8_0`, `POSTGRES_9_6`,`POSTGRES_10`, `POSTGRES_11`,
// `POSTGRES_12`, `POSTGRES_13`, `POSTGRES_14`, `POSTGRES_15`, `SQLSERVER_2017_STANDARD`,
// `SQLSERVER_2017_ENTERPRISE`, `SQLSERVER_2017_EXPRESS`, `SQLSERVER_2017_WEB`.
// `SQLSERVER_2019_STANDARD`, `SQLSERVER_2019_ENTERPRISE`, `SQLSERVER_2019_EXPRESS`,
// `SQLSERVER_2019_WEB`.
// [Database Version Policies](https://cloud.google.com/sql/docs/db-versions)
// includes an up-to-date reference of supported versions.
DatabaseVersion string `pulumi:"databaseVersion"`
// Whether or not to allow the provider to destroy the instance. Unless this field is set to false
// in state, a `destroy` or `update` command that deletes the instance will fail. Defaults to `true`.
DeletionProtection *bool `pulumi:"deletionProtection"`
// The full path to the encryption key used for the CMEK disk encryption. Setting
// up disk encryption currently requires manual steps outside of this provider.
// The provided key must be in the same region as the SQL instance. In order
// to use this feature, a special kind of service account must be created and
// granted permission on this key. This step can currently only be done
// manually, please see [this step](https://cloud.google.com/sql/docs/mysql/configure-cmek#service-account).
// That service account needs the `Cloud KMS > Cloud KMS CryptoKey Encrypter/Decrypter` role on your
// key - please see [this step](https://cloud.google.com/sql/docs/mysql/configure-cmek#grantkey).
EncryptionKeyName *string `pulumi:"encryptionKeyName"`
// The type of the instance. The supported values are `SQL_INSTANCE_TYPE_UNSPECIFIED`, `CLOUD_SQL_INSTANCE`, `ON_PREMISES_INSTANCE` and `READ_REPLICA_INSTANCE`.
InstanceType *string `pulumi:"instanceType"`
// The current software version on the instance. This attribute can not be set during creation. Refer to `availableMaintenanceVersions` attribute to see what `maintenanceVersion` are available for upgrade. When this attribute gets updated, it will cause an instance restart. Setting a `maintenanceVersion` value that is older than the current one on the instance will be ignored.
MaintenanceVersion *string `pulumi:"maintenanceVersion"`
// The name of the existing instance that will
// act as the master in the replication setup. Note, this requires the master to
// have `binaryLogEnabled` set, as well as existing backups.
MasterInstanceName *string `pulumi:"masterInstanceName"`
// The name of the instance. If the name is left
// blank, the provider will randomly generate one when the instance is first
// created. This is done because after a name is used, it cannot be reused for
// up to [one week](https://cloud.google.com/sql/docs/delete-instance).
Name *string `pulumi:"name"`
// The ID of the project in which the resource belongs. If it
// is not provided, the provider project is used.
Project *string `pulumi:"project"`
// The region the instance will sit in. If a region is not provided in the resource definition,
// the provider region will be used instead.
//
// ***
Region *string `pulumi:"region"`
// The configuration for replication. The
// configuration is detailed below. Valid only for MySQL instances.
ReplicaConfiguration *DatabaseInstanceReplicaConfiguration `pulumi:"replicaConfiguration"`
// The context needed to restore the database to a backup run. This field will
// cause the provider to trigger the database to restore from the backup run indicated. The configuration is detailed below.
// **NOTE:** Restoring from a backup is an imperative action and not recommended via this provider. Adding or modifying this
// block during resource creation/update will trigger the restore action after the resource is created/updated.
RestoreBackupContext *DatabaseInstanceRestoreBackupContext `pulumi:"restoreBackupContext"`
// Initial root password. Can be updated. Required for MS SQL Server.
RootPassword *string `pulumi:"rootPassword"`
// The settings to use for the database. The
// configuration is detailed below. Required if `clone` is not set.
Settings *DatabaseInstanceSettings `pulumi:"settings"`
}
// The set of arguments for constructing a DatabaseInstance resource.
type DatabaseInstanceArgs struct {
// The context needed to create this instance as a clone of another instance. When this field is set during
// resource creation, this provider will attempt to clone another instance as indicated in the context. The
// configuration is detailed below.
Clone DatabaseInstanceClonePtrInput
// The MySQL, PostgreSQL or
// SQL Server version to use. Supported values include `MYSQL_5_6`,
// `MYSQL_5_7`, `MYSQL_8_0`, `POSTGRES_9_6`,`POSTGRES_10`, `POSTGRES_11`,
// `POSTGRES_12`, `POSTGRES_13`, `POSTGRES_14`, `POSTGRES_15`, `SQLSERVER_2017_STANDARD`,
// `SQLSERVER_2017_ENTERPRISE`, `SQLSERVER_2017_EXPRESS`, `SQLSERVER_2017_WEB`.
// `SQLSERVER_2019_STANDARD`, `SQLSERVER_2019_ENTERPRISE`, `SQLSERVER_2019_EXPRESS`,
// `SQLSERVER_2019_WEB`.
// [Database Version Policies](https://cloud.google.com/sql/docs/db-versions)
// includes an up-to-date reference of supported versions.
DatabaseVersion pulumi.StringInput
// Whether or not to allow the provider to destroy the instance. Unless this field is set to false
// in state, a `destroy` or `update` command that deletes the instance will fail. Defaults to `true`.
DeletionProtection pulumi.BoolPtrInput
// The full path to the encryption key used for the CMEK disk encryption. Setting
// up disk encryption currently requires manual steps outside of this provider.
// The provided key must be in the same region as the SQL instance. In order
// to use this feature, a special kind of service account must be created and
// granted permission on this key. This step can currently only be done
// manually, please see [this step](https://cloud.google.com/sql/docs/mysql/configure-cmek#service-account).
// That service account needs the `Cloud KMS > Cloud KMS CryptoKey Encrypter/Decrypter` role on your
// key - please see [this step](https://cloud.google.com/sql/docs/mysql/configure-cmek#grantkey).
EncryptionKeyName pulumi.StringPtrInput
// The type of the instance. The supported values are `SQL_INSTANCE_TYPE_UNSPECIFIED`, `CLOUD_SQL_INSTANCE`, `ON_PREMISES_INSTANCE` and `READ_REPLICA_INSTANCE`.
InstanceType pulumi.StringPtrInput
// The current software version on the instance. This attribute can not be set during creation. Refer to `availableMaintenanceVersions` attribute to see what `maintenanceVersion` are available for upgrade. When this attribute gets updated, it will cause an instance restart. Setting a `maintenanceVersion` value that is older than the current one on the instance will be ignored.
MaintenanceVersion pulumi.StringPtrInput
// The name of the existing instance that will
// act as the master in the replication setup. Note, this requires the master to
// have `binaryLogEnabled` set, as well as existing backups.
MasterInstanceName pulumi.StringPtrInput
// The name of the instance. If the name is left
// blank, the provider will randomly generate one when the instance is first
// created. This is done because after a name is used, it cannot be reused for
// up to [one week](https://cloud.google.com/sql/docs/delete-instance).
Name pulumi.StringPtrInput
// The ID of the project in which the resource belongs. If it
// is not provided, the provider project is used.
Project pulumi.StringPtrInput
// The region the instance will sit in. If a region is not provided in the resource definition,
// the provider region will be used instead.
//
// ***
Region pulumi.StringPtrInput
// The configuration for replication. The
// configuration is detailed below. Valid only for MySQL instances.
ReplicaConfiguration DatabaseInstanceReplicaConfigurationPtrInput
// The context needed to restore the database to a backup run. This field will
// cause the provider to trigger the database to restore from the backup run indicated. The configuration is detailed below.
// **NOTE:** Restoring from a backup is an imperative action and not recommended via this provider. Adding or modifying this
// block during resource creation/update will trigger the restore action after the resource is created/updated.
RestoreBackupContext DatabaseInstanceRestoreBackupContextPtrInput
// Initial root password. Can be updated. Required for MS SQL Server.
RootPassword pulumi.StringPtrInput
// The settings to use for the database. The
// configuration is detailed below. Required if `clone` is not set.
Settings DatabaseInstanceSettingsPtrInput
}
func (DatabaseInstanceArgs) ElementType() reflect.Type {
return reflect.TypeOf((*databaseInstanceArgs)(nil)).Elem()
}
type DatabaseInstanceInput interface {
pulumi.Input
ToDatabaseInstanceOutput() DatabaseInstanceOutput
ToDatabaseInstanceOutputWithContext(ctx context.Context) DatabaseInstanceOutput
}
func (*DatabaseInstance) ElementType() reflect.Type {
return reflect.TypeOf((**DatabaseInstance)(nil)).Elem()
}
func (i *DatabaseInstance) ToDatabaseInstanceOutput() DatabaseInstanceOutput {
return i.ToDatabaseInstanceOutputWithContext(context.Background())
}
func (i *DatabaseInstance) ToDatabaseInstanceOutputWithContext(ctx context.Context) DatabaseInstanceOutput {
return pulumi.ToOutputWithContext(ctx, i).(DatabaseInstanceOutput)
}
// DatabaseInstanceArrayInput is an input type that accepts DatabaseInstanceArray and DatabaseInstanceArrayOutput values.
// You can construct a concrete instance of `DatabaseInstanceArrayInput` via:
//
// DatabaseInstanceArray{ DatabaseInstanceArgs{...} }
type DatabaseInstanceArrayInput interface {
pulumi.Input
ToDatabaseInstanceArrayOutput() DatabaseInstanceArrayOutput
ToDatabaseInstanceArrayOutputWithContext(context.Context) DatabaseInstanceArrayOutput
}
type DatabaseInstanceArray []DatabaseInstanceInput
func (DatabaseInstanceArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*DatabaseInstance)(nil)).Elem()
}
func (i DatabaseInstanceArray) ToDatabaseInstanceArrayOutput() DatabaseInstanceArrayOutput {
return i.ToDatabaseInstanceArrayOutputWithContext(context.Background())
}
func (i DatabaseInstanceArray) ToDatabaseInstanceArrayOutputWithContext(ctx context.Context) DatabaseInstanceArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(DatabaseInstanceArrayOutput)
}
// DatabaseInstanceMapInput is an input type that accepts DatabaseInstanceMap and DatabaseInstanceMapOutput values.
// You can construct a concrete instance of `DatabaseInstanceMapInput` via:
//
// DatabaseInstanceMap{ "key": DatabaseInstanceArgs{...} }
type DatabaseInstanceMapInput interface {
pulumi.Input
ToDatabaseInstanceMapOutput() DatabaseInstanceMapOutput
ToDatabaseInstanceMapOutputWithContext(context.Context) DatabaseInstanceMapOutput
}
type DatabaseInstanceMap map[string]DatabaseInstanceInput
func (DatabaseInstanceMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*DatabaseInstance)(nil)).Elem()
}
func (i DatabaseInstanceMap) ToDatabaseInstanceMapOutput() DatabaseInstanceMapOutput {
return i.ToDatabaseInstanceMapOutputWithContext(context.Background())
}
func (i DatabaseInstanceMap) ToDatabaseInstanceMapOutputWithContext(ctx context.Context) DatabaseInstanceMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(DatabaseInstanceMapOutput)
}
type DatabaseInstanceOutput struct{ *pulumi.OutputState }
func (DatabaseInstanceOutput) ElementType() reflect.Type {
return reflect.TypeOf((**DatabaseInstance)(nil)).Elem()
}
func (o DatabaseInstanceOutput) ToDatabaseInstanceOutput() DatabaseInstanceOutput {
return o
}
func (o DatabaseInstanceOutput) ToDatabaseInstanceOutputWithContext(ctx context.Context) DatabaseInstanceOutput {
return o
}
// The list of all maintenance versions applicable on the instance.
func (o DatabaseInstanceOutput) AvailableMaintenanceVersions() pulumi.StringArrayOutput {
return o.ApplyT(func(v *DatabaseInstance) pulumi.StringArrayOutput { return v.AvailableMaintenanceVersions }).(pulumi.StringArrayOutput)
}
// The context needed to create this instance as a clone of another instance. When this field is set during
// resource creation, this provider will attempt to clone another instance as indicated in the context. The
// configuration is detailed below.
func (o DatabaseInstanceOutput) Clone() DatabaseInstanceClonePtrOutput {
return o.ApplyT(func(v *DatabaseInstance) DatabaseInstanceClonePtrOutput { return v.Clone }).(DatabaseInstanceClonePtrOutput)
}
// The connection name of the instance to be used in
// connection strings. For example, when connecting with [Cloud SQL Proxy](https://cloud.google.com/sql/docs/mysql/connect-admin-proxy).
func (o DatabaseInstanceOutput) ConnectionName() pulumi.StringOutput {
return o.ApplyT(func(v *DatabaseInstance) pulumi.StringOutput { return v.ConnectionName }).(pulumi.StringOutput)
}
// The MySQL, PostgreSQL or
// SQL Server version to use. Supported values include `MYSQL_5_6`,
// `MYSQL_5_7`, `MYSQL_8_0`, `POSTGRES_9_6`,`POSTGRES_10`, `POSTGRES_11`,
// `POSTGRES_12`, `POSTGRES_13`, `POSTGRES_14`, `POSTGRES_15`, `SQLSERVER_2017_STANDARD`,
// `SQLSERVER_2017_ENTERPRISE`, `SQLSERVER_2017_EXPRESS`, `SQLSERVER_2017_WEB`.
// `SQLSERVER_2019_STANDARD`, `SQLSERVER_2019_ENTERPRISE`, `SQLSERVER_2019_EXPRESS`,
// `SQLSERVER_2019_WEB`.
// [Database Version Policies](https://cloud.google.com/sql/docs/db-versions)
// includes an up-to-date reference of supported versions.
func (o DatabaseInstanceOutput) DatabaseVersion() pulumi.StringOutput {
return o.ApplyT(func(v *DatabaseInstance) pulumi.StringOutput { return v.DatabaseVersion }).(pulumi.StringOutput)
}
// Whether or not to allow the provider to destroy the instance. Unless this field is set to false
// in state, a `destroy` or `update` command that deletes the instance will fail. Defaults to `true`.
func (o DatabaseInstanceOutput) DeletionProtection() pulumi.BoolPtrOutput {
return o.ApplyT(func(v *DatabaseInstance) pulumi.BoolPtrOutput { return v.DeletionProtection }).(pulumi.BoolPtrOutput)
}
// The dns name of the instance.
func (o DatabaseInstanceOutput) DnsName() pulumi.StringOutput {
return o.ApplyT(func(v *DatabaseInstance) pulumi.StringOutput { return v.DnsName }).(pulumi.StringOutput)
}
// The full path to the encryption key used for the CMEK disk encryption. Setting
// up disk encryption currently requires manual steps outside of this provider.
// The provided key must be in the same region as the SQL instance. In order
// to use this feature, a special kind of service account must be created and
// granted permission on this key. This step can currently only be done
// manually, please see [this step](https://cloud.google.com/sql/docs/mysql/configure-cmek#service-account).
// That service account needs the `Cloud KMS > Cloud KMS CryptoKey Encrypter/Decrypter` role on your
// key - please see [this step](https://cloud.google.com/sql/docs/mysql/configure-cmek#grantkey).
func (o DatabaseInstanceOutput) EncryptionKeyName() pulumi.StringOutput {
return o.ApplyT(func(v *DatabaseInstance) pulumi.StringOutput { return v.EncryptionKeyName }).(pulumi.StringOutput)
}
// The first IPv4 address of any type assigned.
func (o DatabaseInstanceOutput) FirstIpAddress() pulumi.StringOutput {
return o.ApplyT(func(v *DatabaseInstance) pulumi.StringOutput { return v.FirstIpAddress }).(pulumi.StringOutput)
}
// The type of the instance. The supported values are `SQL_INSTANCE_TYPE_UNSPECIFIED`, `CLOUD_SQL_INSTANCE`, `ON_PREMISES_INSTANCE` and `READ_REPLICA_INSTANCE`.
func (o DatabaseInstanceOutput) InstanceType() pulumi.StringOutput {
return o.ApplyT(func(v *DatabaseInstance) pulumi.StringOutput { return v.InstanceType }).(pulumi.StringOutput)
}
func (o DatabaseInstanceOutput) IpAddresses() DatabaseInstanceIpAddressArrayOutput {
return o.ApplyT(func(v *DatabaseInstance) DatabaseInstanceIpAddressArrayOutput { return v.IpAddresses }).(DatabaseInstanceIpAddressArrayOutput)
}
// The current software version on the instance. This attribute can not be set during creation. Refer to `availableMaintenanceVersions` attribute to see what `maintenanceVersion` are available for upgrade. When this attribute gets updated, it will cause an instance restart. Setting a `maintenanceVersion` value that is older than the current one on the instance will be ignored.
func (o DatabaseInstanceOutput) MaintenanceVersion() pulumi.StringOutput {
return o.ApplyT(func(v *DatabaseInstance) pulumi.StringOutput { return v.MaintenanceVersion }).(pulumi.StringOutput)
}
// The name of the existing instance that will
// act as the master in the replication setup. Note, this requires the master to
// have `binaryLogEnabled` set, as well as existing backups.
func (o DatabaseInstanceOutput) MasterInstanceName() pulumi.StringOutput {
return o.ApplyT(func(v *DatabaseInstance) pulumi.StringOutput { return v.MasterInstanceName }).(pulumi.StringOutput)
}
// The name of the instance. If the name is left
// blank, the provider will randomly generate one when the instance is first
// created. This is done because after a name is used, it cannot be reused for
// up to [one week](https://cloud.google.com/sql/docs/delete-instance).
func (o DatabaseInstanceOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *DatabaseInstance) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// The first private (`PRIVATE`) IPv4 address assigned.
func (o DatabaseInstanceOutput) PrivateIpAddress() pulumi.StringOutput {
return o.ApplyT(func(v *DatabaseInstance) pulumi.StringOutput { return v.PrivateIpAddress }).(pulumi.StringOutput)
}
// The ID of the project in which the resource belongs. If it
// is not provided, the provider project is used.
func (o DatabaseInstanceOutput) Project() pulumi.StringOutput {
return o.ApplyT(func(v *DatabaseInstance) pulumi.StringOutput { return v.Project }).(pulumi.StringOutput)
}
// the URI that points to the service attachment of the instance.
func (o DatabaseInstanceOutput) PscServiceAttachmentLink() pulumi.StringOutput {
return o.ApplyT(func(v *DatabaseInstance) pulumi.StringOutput { return v.PscServiceAttachmentLink }).(pulumi.StringOutput)
}
// The first public (`PRIMARY`) IPv4 address assigned.
func (o DatabaseInstanceOutput) PublicIpAddress() pulumi.StringOutput {
return o.ApplyT(func(v *DatabaseInstance) pulumi.StringOutput { return v.PublicIpAddress }).(pulumi.StringOutput)
}
// The region the instance will sit in. If a region is not provided in the resource definition,
// the provider region will be used instead.
//
// ***
func (o DatabaseInstanceOutput) Region() pulumi.StringOutput {
return o.ApplyT(func(v *DatabaseInstance) pulumi.StringOutput { return v.Region }).(pulumi.StringOutput)
}
// The configuration for replication. The
// configuration is detailed below. Valid only for MySQL instances.
func (o DatabaseInstanceOutput) ReplicaConfiguration() DatabaseInstanceReplicaConfigurationOutput {
return o.ApplyT(func(v *DatabaseInstance) DatabaseInstanceReplicaConfigurationOutput { return v.ReplicaConfiguration }).(DatabaseInstanceReplicaConfigurationOutput)
}
// The context needed to restore the database to a backup run. This field will
// cause the provider to trigger the database to restore from the backup run indicated. The configuration is detailed below.
// **NOTE:** Restoring from a backup is an imperative action and not recommended via this provider. Adding or modifying this
// block during resource creation/update will trigger the restore action after the resource is created/updated.
func (o DatabaseInstanceOutput) RestoreBackupContext() DatabaseInstanceRestoreBackupContextPtrOutput {
return o.ApplyT(func(v *DatabaseInstance) DatabaseInstanceRestoreBackupContextPtrOutput { return v.RestoreBackupContext }).(DatabaseInstanceRestoreBackupContextPtrOutput)
}
// Initial root password. Can be updated. Required for MS SQL Server.
func (o DatabaseInstanceOutput) RootPassword() pulumi.StringPtrOutput {
return o.ApplyT(func(v *DatabaseInstance) pulumi.StringPtrOutput { return v.RootPassword }).(pulumi.StringPtrOutput)
}
// The URI of the created resource.
func (o DatabaseInstanceOutput) SelfLink() pulumi.StringOutput {
return o.ApplyT(func(v *DatabaseInstance) pulumi.StringOutput { return v.SelfLink }).(pulumi.StringOutput)
}
func (o DatabaseInstanceOutput) ServerCaCerts() DatabaseInstanceServerCaCertArrayOutput {
return o.ApplyT(func(v *DatabaseInstance) DatabaseInstanceServerCaCertArrayOutput { return v.ServerCaCerts }).(DatabaseInstanceServerCaCertArrayOutput)
}
// The service account email address assigned to the
// instance.
func (o DatabaseInstanceOutput) ServiceAccountEmailAddress() pulumi.StringOutput {
return o.ApplyT(func(v *DatabaseInstance) pulumi.StringOutput { return v.ServiceAccountEmailAddress }).(pulumi.StringOutput)
}
// The settings to use for the database. The
// configuration is detailed below. Required if `clone` is not set.
func (o DatabaseInstanceOutput) Settings() DatabaseInstanceSettingsOutput {
return o.ApplyT(func(v *DatabaseInstance) DatabaseInstanceSettingsOutput { return v.Settings }).(DatabaseInstanceSettingsOutput)
}
type DatabaseInstanceArrayOutput struct{ *pulumi.OutputState }
func (DatabaseInstanceArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*DatabaseInstance)(nil)).Elem()
}
func (o DatabaseInstanceArrayOutput) ToDatabaseInstanceArrayOutput() DatabaseInstanceArrayOutput {
return o
}
func (o DatabaseInstanceArrayOutput) ToDatabaseInstanceArrayOutputWithContext(ctx context.Context) DatabaseInstanceArrayOutput {
return o
}
func (o DatabaseInstanceArrayOutput) Index(i pulumi.IntInput) DatabaseInstanceOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *DatabaseInstance {
return vs[0].([]*DatabaseInstance)[vs[1].(int)]
}).(DatabaseInstanceOutput)
}
type DatabaseInstanceMapOutput struct{ *pulumi.OutputState }
func (DatabaseInstanceMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*DatabaseInstance)(nil)).Elem()
}
func (o DatabaseInstanceMapOutput) ToDatabaseInstanceMapOutput() DatabaseInstanceMapOutput {
return o
}
func (o DatabaseInstanceMapOutput) ToDatabaseInstanceMapOutputWithContext(ctx context.Context) DatabaseInstanceMapOutput {
return o
}
func (o DatabaseInstanceMapOutput) MapIndex(k pulumi.StringInput) DatabaseInstanceOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *DatabaseInstance {
return vs[0].(map[string]*DatabaseInstance)[vs[1].(string)]
}).(DatabaseInstanceOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*DatabaseInstanceInput)(nil)).Elem(), &DatabaseInstance{})
pulumi.RegisterInputType(reflect.TypeOf((*DatabaseInstanceArrayInput)(nil)).Elem(), DatabaseInstanceArray{})
pulumi.RegisterInputType(reflect.TypeOf((*DatabaseInstanceMapInput)(nil)).Elem(), DatabaseInstanceMap{})
pulumi.RegisterOutputType(DatabaseInstanceOutput{})
pulumi.RegisterOutputType(DatabaseInstanceArrayOutput{})
pulumi.RegisterOutputType(DatabaseInstanceMapOutput{})
}