@@ -132,13 +132,13 @@ function convertServiceInputs(inputs: DefangServiceInputs): pb.Service {
132
132
resources . setReservations ( reservations ) ;
133
133
deploy . setResources ( resources ) ;
134
134
}
135
- switch ( inputs . networks ?. [ 0 ] ) {
136
- case "public" :
137
- service . setNetworks ( pb . Network . PUBLIC ) ;
138
- break ;
139
- case "private" :
140
- service . setNetworks ( pb . Network . PRIVATE ) ;
141
- break ;
135
+ const publicNetwork = inputs . networks ?. public ;
136
+ const privateNetwork = inputs . networks ?. private ;
137
+ if ( publicNetwork !== undefined ) {
138
+ service . setNetworks ( pb . Network . PUBLIC ) ;
139
+ service . setAliasesList ( publicNetwork ?. aliases ?? [ ] ) ;
140
+ } else if ( privateNetwork !== undefined ) {
141
+ service . setNetworks ( pb . Network . PRIVATE ) ;
142
142
}
143
143
service . setDeploy ( deploy ) ;
144
144
service . setPlatform (
@@ -430,7 +430,7 @@ interface DefangServiceInputs {
430
430
image ?: string ;
431
431
init ?: boolean ;
432
432
name : string ;
433
- networks ?: [ Network ] ;
433
+ networks ?: Record < NetworkName , Network > ;
434
434
platform ?: Platform ;
435
435
ports ?: Port [ ] ;
436
436
project : string ;
@@ -571,6 +571,12 @@ const defangServiceProvider: pulumi.dynamic.ResourceProvider<
571
571
}
572
572
}
573
573
}
574
+ if ( Object . keys ( news . networks || { } ) . length > 1 ) {
575
+ failures . push ( {
576
+ property : "networks" ,
577
+ reason : "only one network can be specified" ,
578
+ } ) ;
579
+ }
574
580
for ( const secret of news . secrets || [ ] ) {
575
581
// TODO: validate source name
576
582
if ( ! secret . source ) {
@@ -711,7 +717,7 @@ const defangServiceProvider: pulumi.dynamic.ResourceProvider<
711
717
id : string ,
712
718
olds ?: DefangServiceOutputs
713
719
) : Promise < pulumi . dynamic . ReadResult < DefangServiceOutputs > > {
714
- const serviceId = new pb . ServiceID ( ) ;
720
+ const serviceId = new pb . GetRequest ( ) ;
715
721
// serviceId.setProject(project);
716
722
serviceId . setName ( id ) ;
717
723
assert ( olds ?. fabricDNS , "fabricDNS is required" ) ;
@@ -745,7 +751,8 @@ const defangServiceProvider: pulumi.dynamic.ResourceProvider<
745
751
export type Platform = "linux/arm64" | "linux/amd64" | "linux" ;
746
752
export type Protocol = "tcp" | "udp" | "http" | "http2" | "grpc" ;
747
753
export type DeviceCapability = "gpu" ;
748
- export type Network = "private" | "public" ;
754
+ export type NetworkName = "private" | "public" ;
755
+ export type Network = { aliases ?: string [ ] } | null ; // TODO: pulumi.Input<string>[]
749
756
750
757
export interface Port {
751
758
target : number ;
@@ -813,7 +820,7 @@ export interface DefangServiceArgs {
813
820
/** the platform to deploy to; defaults to "linux/amd64" */
814
821
platform ?: pulumi . Input < Platform > ;
815
822
/** which network the service is in, ie. whether the service requires a public IP or not; defaults to "private" (was: internal=true) */
816
- networks ?: [ Network ] ;
823
+ networks ?: Record < NetworkName , Network > ;
817
824
/** the optional deployment configuration */
818
825
deploy ?: pulumi . Input < Deploy > ;
819
826
/** the ports to expose */
0 commit comments