@@ -257,6 +257,18 @@ func resourceArmRedisCache() *schema.Resource {
257
257
Sensitive : true ,
258
258
},
259
259
260
+ "primary_connection_string" : {
261
+ Type : schema .TypeString ,
262
+ Computed : true ,
263
+ Sensitive : true ,
264
+ },
265
+
266
+ "secondary_connection_string" : {
267
+ Type : schema .TypeString ,
268
+ Computed : true ,
269
+ Sensitive : true ,
270
+ },
271
+
260
272
"tags" : tags .Schema (),
261
273
},
262
274
}
@@ -540,7 +552,8 @@ func resourceArmRedisCacheRead(d *schema.ResourceData, meta interface{}) error {
540
552
d .Set ("sku_name" , sku .Name )
541
553
}
542
554
543
- if props := resp .Properties ; props != nil {
555
+ props := resp .Properties
556
+ if props != nil {
544
557
d .Set ("ssl_port" , props .SslPort )
545
558
d .Set ("hostname" , props .HostName )
546
559
d .Set ("minimum_tls_version" , string (props .MinimumTLSVersion ))
@@ -564,6 +577,11 @@ func resourceArmRedisCacheRead(d *schema.ResourceData, meta interface{}) error {
564
577
d .Set ("primary_access_key" , keysResp .PrimaryKey )
565
578
d .Set ("secondary_access_key" , keysResp .SecondaryKey )
566
579
580
+ if props != nil {
581
+ d .Set ("primary_connection_string" , getRedisConnectionString (* props .HostName , * props .SslPort , * keysResp .PrimaryKey , * props .EnableNonSslPort ))
582
+ d .Set ("secondary_connection_string" , getRedisConnectionString (* props .HostName , * props .SslPort , * keysResp .SecondaryKey , * props .EnableNonSslPort ))
583
+ }
584
+
567
585
return tags .FlattenAndSet (d , resp .Tags )
568
586
}
569
587
@@ -910,3 +928,7 @@ func validateRedisBackupFrequency(v interface{}, _ string) (warnings []string, e
910
928
911
929
return warnings , errors
912
930
}
931
+
932
+ func getRedisConnectionString (redisHostName string , sslPort int32 , accessKey string , enableSslPort bool ) string {
933
+ return fmt .Sprintf ("%s:%d,password=%s,ssl=%t,abortConnect=False" , redisHostName , sslPort , accessKey , enableSslPort )
934
+ }
0 commit comments