1. Packages
  2. AWS
  3. API Docs
  4. wafregional
  5. getSubscribedRuleGroup
AWS v6.55.0 published on Monday, Oct 7, 2024 by Pulumi

aws.wafregional.getSubscribedRuleGroup

Explore with Pulumi AI

aws logo
AWS v6.55.0 published on Monday, Oct 7, 2024 by Pulumi

    aws.wafregional.getSubscribedRuleGroup retrieves information about a Managed WAF Rule Group from AWS Marketplace for use in WAF Regional (needs to be subscribed to first).

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const byName = aws.wafregional.getSubscribedRuleGroup({
        name: "F5 Bot Detection Signatures For AWS WAF",
    });
    const byMetricName = aws.wafregional.getSubscribedRuleGroup({
        metricName: "F5BotDetectionSignatures",
    });
    const acl = new aws.wafregional.WebAcl("acl", {rules: [
        {
            priority: 1,
            ruleId: byName.then(byName => byName.id),
            type: "GROUP",
        },
        {
            priority: 2,
            ruleId: byMetricName.then(byMetricName => byMetricName.id),
            type: "GROUP",
        },
    ]});
    
    import pulumi
    import pulumi_aws as aws
    
    by_name = aws.wafregional.get_subscribed_rule_group(name="F5 Bot Detection Signatures For AWS WAF")
    by_metric_name = aws.wafregional.get_subscribed_rule_group(metric_name="F5BotDetectionSignatures")
    acl = aws.wafregional.WebAcl("acl", rules=[
        {
            "priority": 1,
            "rule_id": by_name.id,
            "type": "GROUP",
        },
        {
            "priority": 2,
            "rule_id": by_metric_name.id,
            "type": "GROUP",
        },
    ])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/wafregional"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		byName, err := wafregional.GetSubscribedRuleGroup(ctx, &wafregional.GetSubscribedRuleGroupArgs{
    			Name: pulumi.StringRef("F5 Bot Detection Signatures For AWS WAF"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		byMetricName, err := wafregional.GetSubscribedRuleGroup(ctx, &wafregional.GetSubscribedRuleGroupArgs{
    			MetricName: pulumi.StringRef("F5BotDetectionSignatures"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = wafregional.NewWebAcl(ctx, "acl", &wafregional.WebAclArgs{
    			Rules: wafregional.WebAclRuleArray{
    				&wafregional.WebAclRuleArgs{
    					Priority: pulumi.Int(1),
    					RuleId:   pulumi.String(byName.Id),
    					Type:     pulumi.String("GROUP"),
    				},
    				&wafregional.WebAclRuleArgs{
    					Priority: pulumi.Int(2),
    					RuleId:   pulumi.String(byMetricName.Id),
    					Type:     pulumi.String("GROUP"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var byName = Aws.WafRegional.GetSubscribedRuleGroup.Invoke(new()
        {
            Name = "F5 Bot Detection Signatures For AWS WAF",
        });
    
        var byMetricName = Aws.WafRegional.GetSubscribedRuleGroup.Invoke(new()
        {
            MetricName = "F5BotDetectionSignatures",
        });
    
        var acl = new Aws.WafRegional.WebAcl("acl", new()
        {
            Rules = new[]
            {
                new Aws.WafRegional.Inputs.WebAclRuleArgs
                {
                    Priority = 1,
                    RuleId = byName.Apply(getSubscribedRuleGroupResult => getSubscribedRuleGroupResult.Id),
                    Type = "GROUP",
                },
                new Aws.WafRegional.Inputs.WebAclRuleArgs
                {
                    Priority = 2,
                    RuleId = byMetricName.Apply(getSubscribedRuleGroupResult => getSubscribedRuleGroupResult.Id),
                    Type = "GROUP",
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.wafregional.WafregionalFunctions;
    import com.pulumi.aws.wafregional.inputs.GetSubscribedRuleGroupArgs;
    import com.pulumi.aws.wafregional.WebAcl;
    import com.pulumi.aws.wafregional.WebAclArgs;
    import com.pulumi.aws.wafregional.inputs.WebAclRuleArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            final var byName = WafregionalFunctions.getSubscribedRuleGroup(GetSubscribedRuleGroupArgs.builder()
                .name("F5 Bot Detection Signatures For AWS WAF")
                .build());
    
            final var byMetricName = WafregionalFunctions.getSubscribedRuleGroup(GetSubscribedRuleGroupArgs.builder()
                .metricName("F5BotDetectionSignatures")
                .build());
    
            var acl = new WebAcl("acl", WebAclArgs.builder()
                .rules(            
                    WebAclRuleArgs.builder()
                        .priority(1)
                        .ruleId(byName.applyValue(getSubscribedRuleGroupResult -> getSubscribedRuleGroupResult.id()))
                        .type("GROUP")
                        .build(),
                    WebAclRuleArgs.builder()
                        .priority(2)
                        .ruleId(byMetricName.applyValue(getSubscribedRuleGroupResult -> getSubscribedRuleGroupResult.id()))
                        .type("GROUP")
                        .build())
                .build());
    
        }
    }
    
    resources:
      acl:
        type: aws:wafregional:WebAcl
        properties:
          rules:
            - priority: 1
              ruleId: ${byName.id}
              type: GROUP
            - priority: 2
              ruleId: ${byMetricName.id}
              type: GROUP
    variables:
      byName:
        fn::invoke:
          Function: aws:wafregional:getSubscribedRuleGroup
          Arguments:
            name: F5 Bot Detection Signatures For AWS WAF
      byMetricName:
        fn::invoke:
          Function: aws:wafregional:getSubscribedRuleGroup
          Arguments:
            metricName: F5BotDetectionSignatures
    

    Using getSubscribedRuleGroup

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getSubscribedRuleGroup(args: GetSubscribedRuleGroupArgs, opts?: InvokeOptions): Promise<GetSubscribedRuleGroupResult>
    function getSubscribedRuleGroupOutput(args: GetSubscribedRuleGroupOutputArgs, opts?: InvokeOptions): Output<GetSubscribedRuleGroupResult>
    def get_subscribed_rule_group(metric_name: Optional[str] = None,
                                  name: Optional[str] = None,
                                  opts: Optional[InvokeOptions] = None) -> GetSubscribedRuleGroupResult
    def get_subscribed_rule_group_output(metric_name: Optional[pulumi.Input[str]] = None,
                                  name: Optional[pulumi.Input[str]] = None,
                                  opts: Optional[InvokeOptions] = None) -> Output[GetSubscribedRuleGroupResult]
    func GetSubscribedRuleGroup(ctx *Context, args *GetSubscribedRuleGroupArgs, opts ...InvokeOption) (*GetSubscribedRuleGroupResult, error)
    func GetSubscribedRuleGroupOutput(ctx *Context, args *GetSubscribedRuleGroupOutputArgs, opts ...InvokeOption) GetSubscribedRuleGroupResultOutput

    > Note: This function is named GetSubscribedRuleGroup in the Go SDK.

    public static class GetSubscribedRuleGroup 
    {
        public static Task<GetSubscribedRuleGroupResult> InvokeAsync(GetSubscribedRuleGroupArgs args, InvokeOptions? opts = null)
        public static Output<GetSubscribedRuleGroupResult> Invoke(GetSubscribedRuleGroupInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetSubscribedRuleGroupResult> getSubscribedRuleGroup(GetSubscribedRuleGroupArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: aws:wafregional/getSubscribedRuleGroup:getSubscribedRuleGroup
      arguments:
        # arguments dictionary

    The following arguments are supported:

    MetricName string
    Name of the WAF rule group.
    Name string
    Name of the WAF rule group.
    MetricName string
    Name of the WAF rule group.
    Name string
    Name of the WAF rule group.
    metricName String
    Name of the WAF rule group.
    name String
    Name of the WAF rule group.
    metricName string
    Name of the WAF rule group.
    name string
    Name of the WAF rule group.
    metric_name str
    Name of the WAF rule group.
    name str
    Name of the WAF rule group.
    metricName String
    Name of the WAF rule group.
    name String
    Name of the WAF rule group.

    getSubscribedRuleGroup Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    MetricName string
    Name string
    Id string
    The provider-assigned unique ID for this managed resource.
    MetricName string
    Name string
    id String
    The provider-assigned unique ID for this managed resource.
    metricName String
    name String
    id string
    The provider-assigned unique ID for this managed resource.
    metricName string
    name string
    id str
    The provider-assigned unique ID for this managed resource.
    metric_name str
    name str
    id String
    The provider-assigned unique ID for this managed resource.
    metricName String
    name String

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo
    AWS v6.55.0 published on Monday, Oct 7, 2024 by Pulumi