github.com/GoogleCloudPlatform/terraformer@v0.8.18/providers/aws/xray.go (about) 1 package aws 2 3 import ( 4 "context" 5 6 "github.com/GoogleCloudPlatform/terraformer/terraformutils" 7 "github.com/aws/aws-sdk-go-v2/service/xray" 8 ) 9 10 var xrayAllowEmptyValues = []string{"tags."} 11 12 type XrayGenerator struct { 13 AWSService 14 } 15 16 func (g *XrayGenerator) InitResources() error { 17 config, e := g.generateConfig() 18 if e != nil { 19 return e 20 } 21 svc := xray.NewFromConfig(config) 22 23 p := xray.NewGetSamplingRulesPaginator(svc, &xray.GetSamplingRulesInput{}) 24 for p.HasMorePages() { 25 page, err := p.NextPage(context.TODO()) 26 if err != nil { 27 return err 28 } 29 for _, samplingRule := range page.SamplingRuleRecords { 30 // NOTE: Builtin rule with unmodifiable name and 10000 prirority (lowest) 31 if *samplingRule.SamplingRule.RuleName != "Default" { 32 g.Resources = append(g.Resources, terraformutils.NewSimpleResource( 33 *samplingRule.SamplingRule.RuleName, 34 *samplingRule.SamplingRule.RuleName, 35 "aws_xray_sampling_rule", 36 "aws", 37 xrayAllowEmptyValues)) 38 } 39 } 40 } 41 42 return nil 43 }