@@ -1240,3 +1240,75 @@ func TestAccPortActionRequiredFalseAndNull(t *testing.T) {
1240
1240
},
1241
1241
})
1242
1242
}
1243
+
1244
+ func TestAccPortWebhookApproval (t * testing.T ) {
1245
+ identifier := utils .GenID ()
1246
+ actionIdentifier := utils .GenID ()
1247
+ var testAccActionConfigCreate = testAccCreateBlueprintConfig (identifier ) + fmt .Sprintf (`
1248
+ resource "port_action" "create_microservice" {
1249
+ title = "TF Provider Test"
1250
+ identifier = "%s"
1251
+ icon = "Terraform"
1252
+ blueprint = port_blueprint.microservice.id
1253
+ trigger = "DAY-2"
1254
+ kafka_method = {}
1255
+ required_approval = true
1256
+ approval_webhook_notification = {
1257
+ url = "https://example.com"
1258
+ format = "json"
1259
+ }
1260
+ }` , actionIdentifier )
1261
+ resource .Test (t , resource.TestCase {
1262
+ PreCheck : func () { acctest .TestAccPreCheck (t ) },
1263
+ ProtoV6ProviderFactories : acctest .TestAccProtoV6ProviderFactories ,
1264
+ Steps : []resource.TestStep {
1265
+ {
1266
+ Config : acctest .ProviderConfig + testAccActionConfigCreate ,
1267
+ Check : resource .ComposeTestCheckFunc (
1268
+ resource .TestCheckResourceAttr ("port_action.create_microservice" , "title" , "TF Provider Test" ),
1269
+ resource .TestCheckResourceAttr ("port_action.create_microservice" , "identifier" , actionIdentifier ),
1270
+ resource .TestCheckResourceAttr ("port_action.create_microservice" , "icon" , "Terraform" ),
1271
+ resource .TestCheckResourceAttr ("port_action.create_microservice" , "blueprint" , identifier ),
1272
+ resource .TestCheckResourceAttr ("port_action.create_microservice" , "trigger" , "DAY-2" ),
1273
+ resource .TestCheckResourceAttr ("port_action.create_microservice" , "required_approval" , "true" ),
1274
+ resource .TestCheckResourceAttr ("port_action.create_microservice" , "approval_webhook_notification.url" , "https://example.com" ),
1275
+ resource .TestCheckResourceAttr ("port_action.create_microservice" , "approval_webhook_notification.format" , "json" ),
1276
+ ),
1277
+ },
1278
+ },
1279
+ })
1280
+ }
1281
+
1282
+ func TestAccPortEmailApproval (t * testing.T ) {
1283
+ identifier := utils .GenID ()
1284
+ actionIdentifier := utils .GenID ()
1285
+ var testAccActionConfigCreate = testAccCreateBlueprintConfig (identifier ) + fmt .Sprintf (`
1286
+ resource "port_action" "create_microservice" {
1287
+ title = "TF Provider Test"
1288
+ identifier = "%s"
1289
+ icon = "Terraform"
1290
+ blueprint = port_blueprint.microservice.id
1291
+ trigger = "DAY-2"
1292
+ kafka_method = {}
1293
+ required_approval = true
1294
+ approval_email_notification = {}
1295
+ }` , actionIdentifier )
1296
+ resource .Test (t , resource.TestCase {
1297
+ PreCheck : func () { acctest .TestAccPreCheck (t ) },
1298
+ ProtoV6ProviderFactories : acctest .TestAccProtoV6ProviderFactories ,
1299
+ Steps : []resource.TestStep {
1300
+ {
1301
+ Config : acctest .ProviderConfig + testAccActionConfigCreate ,
1302
+ Check : resource .ComposeTestCheckFunc (
1303
+ resource .TestCheckResourceAttr ("port_action.create_microservice" , "title" , "TF Provider Test" ),
1304
+ resource .TestCheckResourceAttr ("port_action.create_microservice" , "identifier" , actionIdentifier ),
1305
+ resource .TestCheckResourceAttr ("port_action.create_microservice" , "icon" , "Terraform" ),
1306
+ resource .TestCheckResourceAttr ("port_action.create_microservice" , "blueprint" , identifier ),
1307
+ resource .TestCheckResourceAttr ("port_action.create_microservice" , "trigger" , "DAY-2" ),
1308
+ resource .TestCheckResourceAttr ("port_action.create_microservice" , "required_approval" , "true" ),
1309
+ resource .TestCheckResourceAttr ("port_action.create_microservice" , "approval_email_notification.%" , "0" ),
1310
+ ),
1311
+ },
1312
+ },
1313
+ })
1314
+ }
0 commit comments