@@ -8,10 +8,11 @@ import (
88 "time"
99
1010 "github.com/aws/aws-sdk-go/aws/arn"
11- v2 "github.com/draios/terraform-provider-sysdig/sysdig/internal/client/v2"
1211 "github.com/hashicorp/terraform-plugin-sdk/v2/diag"
1312 "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
1413 "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
14+
15+ v2 "github.com/draios/terraform-provider-sysdig/sysdig/internal/client/v2"
1516)
1617
1718func getSecureOnboardingClient (c SysdigClients ) (v2.OnboardingSecureInterface , error ) {
@@ -344,6 +345,15 @@ func dataSourceSysdigSecureCloudIngestionAssets() *schema.Resource {
344345 },
345346
346347 Schema : map [string ]* schema.Schema {
348+ "cloud_provider" : {
349+ Type : schema .TypeString ,
350+ Optional : true ,
351+ ValidateFunc : validation .StringInSlice ([]string {"aws" , "gcp" , "azure" }, false ),
352+ },
353+ "cloud_provider_id" : {
354+ Type : schema .TypeString ,
355+ Optional : true ,
356+ },
347357 "aws" : {
348358 Type : schema .TypeMap ,
349359 Computed : true ,
@@ -370,18 +380,25 @@ func dataSourceSysdigSecureCloudIngestionAssetsRead(ctx context.Context, d *sche
370380 return diag .FromErr (err )
371381 }
372382
373- assets , err := client .GetCloudIngestionAssetsSecure (ctx )
383+ assets , err := client .GetCloudIngestionAssetsSecure (ctx , d . Get ( "cloud_provider" ).( string ), d . Get ( "cloud_provider_id" ).( string ) )
374384 if err != nil {
375385 return diag .FromErr (err )
376386 }
377387
378388 assetsAws , _ := assets ["aws" ].(map [string ]interface {})
379389 assetsGcp , _ := assets ["gcp" ].(map [string ]interface {})
380390
391+ var ingestionURL string
392+ if assetsAws ["snsMetadata" ] != nil {
393+ ingestionURL = assetsAws ["snsMetadata" ].(map [string ]interface {})["ingestionURL" ].(string )
394+ }
395+
381396 d .SetId ("cloudIngestionAssets" )
382397 err = d .Set ("aws" , map [string ]interface {}{
383- "eventBusARN" : assetsAws ["eventBusARN" ],
384- "eventBusARNGov" : assetsAws ["eventBusARNGov" ],
398+ "eventBusARN" : assetsAws ["eventBusARN" ],
399+ "eventBusARNGov" : assetsAws ["eventBusARNGov" ],
400+ "sns_routing_key" : assetsAws ["snsRoutingKey" ],
401+ "sns_routing_url" : ingestionURL ,
385402 })
386403 if err != nil {
387404 return diag .FromErr (err )
@@ -456,8 +473,10 @@ func dataSourceSysdigSecureTrustedOracleAppRead(ctx context.Context, d *schema.R
456473 return nil
457474}
458475
459- var matchFirstCap = regexp .MustCompile ("(.)([A-Z][a-z]+)" )
460- var matchAllCap = regexp .MustCompile ("([a-z0-9])([A-Z])" )
476+ var (
477+ matchFirstCap = regexp .MustCompile ("(.)([A-Z][a-z]+)" )
478+ matchAllCap = regexp .MustCompile ("([a-z0-9])([A-Z])" )
479+ )
461480
462481func snakeCase (str string ) string {
463482 snake := matchFirstCap .ReplaceAllString (str , "${1}_${2}" )
0 commit comments