1. Packages
  2. AWS
  3. API Docs
  4. waf
  5. getSubscribedRuleGroup
AWS v6.54.0 published on Friday, Sep 27, 2024 by Pulumi

aws.waf.getSubscribedRuleGroup

Explore with Pulumi AI

aws logo
AWS v6.54.0 published on Friday, Sep 27, 2024 by Pulumi

    aws.waf.getSubscribedRuleGroup retrieves information about a Managed WAF Rule Group from AWS Marketplace (needs to be subscribed to first).

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const byName = aws.waf.getSubscribedRuleGroup({
        name: "F5 Bot Detection Signatures For AWS WAF",
    });
    const byMetricName = aws.waf.getSubscribedRuleGroup({
        metricName: "F5BotDetectionSignatures",
    });
    const acl = new aws.waf.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.waf.get_subscribed_rule_group(name="F5 Bot Detection Signatures For AWS WAF")
    by_metric_name = aws.waf.get_subscribed_rule_group(metric_name="F5BotDetectionSignatures")
    acl = aws.waf.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/waf"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		byName, err := waf.GetSubscribedRuleGroup(ctx, &waf.GetSubscribedRuleGroupArgs{
    			Name: pulumi.StringRef("F5 Bot Detection Signatures For AWS WAF"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		byMetricName, err := waf.GetSubscribedRuleGroup(ctx, &waf.GetSubscribedRuleGroupArgs{
    			MetricName: pulumi.StringRef("F5BotDetectionSignatures"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = waf.NewWebAcl(ctx, "acl", &waf.WebAclArgs{
    			Rules: waf.WebAclRuleArray{
    				&waf.WebAclRuleArgs{
    					Priority: pulumi.Int(1),
    					RuleId:   pulumi.String(byName.Id),
    					Type:     pulumi.String("GROUP"),
    				},
    				&waf.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.Waf.GetSubscribedRuleGroup.Invoke(new()
        {
            Name = "F5 Bot Detection Signatures For AWS WAF",
        });
    
        var byMetricName = Aws.Waf.GetSubscribedRuleGroup.Invoke(new()
        {
            MetricName = "F5BotDetectionSignatures",
        });
    
        var acl = new Aws.Waf.WebAcl("acl", new()
        {
            Rules = new[]
            {
                new Aws.Waf.Inputs.WebAclRuleArgs
                {
                    Priority = 1,
                    RuleId = byName.Apply(getSubscribedRuleGroupResult => getSubscribedRuleGroupResult.Id),
                    Type = "GROUP",
                },
                new Aws.Waf.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.waf.WafFunctions;
    import com.pulumi.aws.waf.inputs.GetSubscribedRuleGroupArgs;
    import com.pulumi.aws.waf.WebAcl;
    import com.pulumi.aws.waf.WebAclArgs;
    import com.pulumi.aws.waf.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 = WafFunctions.getSubscribedRuleGroup(GetSubscribedRuleGroupArgs.builder()
                .name("F5 Bot Detection Signatures For AWS WAF")
                .build());
    
            final var byMetricName = WafFunctions.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:waf:WebAcl
        properties:
          rules:
            - priority: 1
              ruleId: ${byName.id}
              type: GROUP
            - priority: 2
              ruleId: ${byMetricName.id}
              type: GROUP
    variables:
      byName:
        fn::invoke:
          Function: aws:waf:getSubscribedRuleGroup
          Arguments:
            name: F5 Bot Detection Signatures For AWS WAF
      byMetricName:
        fn::invoke:
          Function: aws:waf: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:waf/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.54.0 published on Friday, Sep 27, 2024 by Pulumi