@@ -963,7 +963,7 @@ func ResourceCdnDomain() *schema.Resource {
963
963
Type : schema .TypeString ,
964
964
Required : true ,
965
965
ValidateFunc : validation .StringInSlice ([]string {
966
- "ipaddr" , "domain" , "obs_bucket" ,
966
+ "ipaddr" , "domain" , "obs_bucket" , "third_bucket" ,
967
967
}, true ),
968
968
},
969
969
"active" : {
@@ -1001,6 +1001,50 @@ func ResourceCdnDomain() *schema.Resource {
1001
1001
Optional : true ,
1002
1002
Computed : true ,
1003
1003
},
1004
+ "bucket_access_key" : {
1005
+ Type : schema .TypeString ,
1006
+ Optional : true ,
1007
+ Computed : true ,
1008
+ Description : utils .SchemaDesc (
1009
+ "Third-party object storage access key." ,
1010
+ utils.SchemaDescInput {
1011
+ Internal : true ,
1012
+ },
1013
+ ),
1014
+ },
1015
+ "bucket_secret_key" : {
1016
+ Type : schema .TypeString ,
1017
+ Optional : true ,
1018
+ Computed : true ,
1019
+ Description : utils .SchemaDesc (
1020
+ "Third-party object storage secret key." ,
1021
+ utils.SchemaDescInput {
1022
+ Internal : true ,
1023
+ },
1024
+ ),
1025
+ },
1026
+ "bucket_region" : {
1027
+ Type : schema .TypeString ,
1028
+ Optional : true ,
1029
+ Computed : true ,
1030
+ Description : utils .SchemaDesc (
1031
+ "Third-party object storage bucket region." ,
1032
+ utils.SchemaDescInput {
1033
+ Internal : true ,
1034
+ },
1035
+ ),
1036
+ },
1037
+ "bucket_name" : {
1038
+ Type : schema .TypeString ,
1039
+ Optional : true ,
1040
+ Computed : true ,
1041
+ Description : utils .SchemaDesc (
1042
+ "Third-party object storage bucket name." ,
1043
+ utils.SchemaDescInput {
1044
+ Internal : true ,
1045
+ },
1046
+ ),
1047
+ },
1004
1048
},
1005
1049
},
1006
1050
},
@@ -1222,11 +1266,17 @@ func buildCreateCdnDomainSourcesBodyParams(d *schema.ResourceData) []interface{}
1222
1266
1223
1267
for _ , v := range sources {
1224
1268
sourceMap := v .(map [string ]interface {})
1225
- rst = append (rst , map [string ]interface {}{
1226
- "ip_or_domain" : sourceMap ["origin" ],
1227
- "origin_type" : sourceMap ["origin_type" ],
1228
- "active_standby" : sourceMap ["active" ],
1229
- })
1269
+ rst = append (rst , utils .RemoveNil (map [string ]interface {}{
1270
+ "ip_or_domain" : sourceMap ["origin" ],
1271
+ "origin_type" : sourceMap ["origin_type" ],
1272
+ "active_standby" : sourceMap ["active" ],
1273
+ "obs_bucket_type" : sourceMap ["obs_bucket_type" ],
1274
+ "bucket_access_key" : sourceMap ["bucket_access_key" ],
1275
+ "bucket_secret_key" : sourceMap ["bucket_secret_key" ],
1276
+ "bucket_region" : sourceMap ["bucket_region" ],
1277
+ "bucket_name" : sourceMap ["bucket_name" ],
1278
+ "host_name" : sourceMap ["retrieval_host" ],
1279
+ }))
1230
1280
}
1231
1281
return rst
1232
1282
}
@@ -1444,6 +1494,10 @@ func flattenSourcesAttributes(configResp interface{}) []interface{} {
1444
1494
"retrieval_host" : sourceMap ["host_name" ],
1445
1495
"weight" : sourceMap ["weight" ],
1446
1496
"obs_bucket_type" : sourceMap ["obs_bucket_type" ],
1497
+ "bucket_access_key" : sourceMap ["bucket_access_key" ],
1498
+ "bucket_secret_key" : sourceMap ["bucket_secret_key" ],
1499
+ "bucket_region" : sourceMap ["bucket_region" ],
1500
+ "bucket_name" : sourceMap ["bucket_name" ],
1447
1501
})
1448
1502
}
1449
1503
return rst
@@ -2205,7 +2259,7 @@ func buildCdnDomainSourcesOpts(rawSources []interface{}) []interface{} {
2205
2259
rst := make ([]interface {}, 0 , len (rawSources ))
2206
2260
for _ , v := range rawSources {
2207
2261
rawMap := v .(map [string ]interface {})
2208
- rst = append (rst , map [string ]interface {}{
2262
+ rst = append (rst , utils . RemoveNil ( map [string ]interface {}{
2209
2263
"origin_addr" : rawMap ["origin" ],
2210
2264
"origin_type" : rawMap ["origin_type" ],
2211
2265
"priority" : buildCdnDomainSourcesPriorityOpts (rawMap ["active" ].(int )),
@@ -2215,7 +2269,11 @@ func buildCdnDomainSourcesOpts(rawSources []interface{}) []interface{} {
2215
2269
"host_name" : utils .ValueIgnoreEmpty (rawMap ["retrieval_host" ]),
2216
2270
"weight" : utils .ValueIgnoreEmpty (rawMap ["weight" ]),
2217
2271
"obs_bucket_type" : utils .ValueIgnoreEmpty (rawMap ["obs_bucket_type" ]),
2218
- })
2272
+ "bucket_access_key" : utils .ValueIgnoreEmpty (rawMap ["bucket_access_key" ]),
2273
+ "bucket_secret_key" : utils .ValueIgnoreEmpty (rawMap ["bucket_secret_key" ]),
2274
+ "bucket_region" : utils .ValueIgnoreEmpty (rawMap ["bucket_region" ]),
2275
+ "bucket_name" : utils .ValueIgnoreEmpty (rawMap ["bucket_name" ]),
2276
+ }))
2219
2277
}
2220
2278
return rst
2221
2279
}
0 commit comments