1. Packages
  2. AWS Classic
  3. API Docs
  4. inspector
  5. getRulesPackages

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi

aws.inspector.getRulesPackages

Explore with Pulumi AI

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi

    The Amazon Inspector Classic Rules Packages data source allows access to the list of AWS Inspector Rules Packages which can be used by Amazon Inspector Classic within the region configured in the provider.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    // Declare the data source
    const rules = aws.inspector.getRulesPackages({});
    // e.g., Use in aws_inspector_assessment_template
    const group = new aws.inspector.ResourceGroup("group", {tags: {
        test: "test",
    }});
    const assessment = new aws.inspector.AssessmentTarget("assessment", {
        name: "test",
        resourceGroupArn: group.arn,
    });
    const assessmentAssessmentTemplate = new aws.inspector.AssessmentTemplate("assessment", {
        name: "Test",
        targetArn: assessment.arn,
        duration: 60,
        rulesPackageArns: rules.then(rules => rules.arns),
    });
    
    import pulumi
    import pulumi_aws as aws
    
    # Declare the data source
    rules = aws.inspector.get_rules_packages()
    # e.g., Use in aws_inspector_assessment_template
    group = aws.inspector.ResourceGroup("group", tags={
        "test": "test",
    })
    assessment = aws.inspector.AssessmentTarget("assessment",
        name="test",
        resource_group_arn=group.arn)
    assessment_assessment_template = aws.inspector.AssessmentTemplate("assessment",
        name="Test",
        target_arn=assessment.arn,
        duration=60,
        rules_package_arns=rules.arns)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/inspector"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// Declare the data source
    		rules, err := inspector.GetRulesPackages(ctx, nil, nil)
    		if err != nil {
    			return err
    		}
    		// e.g., Use in aws_inspector_assessment_template
    		group, err := inspector.NewResourceGroup(ctx, "group", &inspector.ResourceGroupArgs{
    			Tags: pulumi.StringMap{
    				"test": pulumi.String("test"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		assessment, err := inspector.NewAssessmentTarget(ctx, "assessment", &inspector.AssessmentTargetArgs{
    			Name:             pulumi.String("test"),
    			ResourceGroupArn: group.Arn,
    		})
    		if err != nil {
    			return err
    		}
    		_, err = inspector.NewAssessmentTemplate(ctx, "assessment", &inspector.AssessmentTemplateArgs{
    			Name:             pulumi.String("Test"),
    			TargetArn:        assessment.Arn,
    			Duration:         pulumi.Int(60),
    			RulesPackageArns: interface{}(rules.Arns),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        // Declare the data source
        var rules = Aws.Inspector.GetRulesPackages.Invoke();
    
        // e.g., Use in aws_inspector_assessment_template
        var @group = new Aws.Inspector.ResourceGroup("group", new()
        {
            Tags = 
            {
                { "test", "test" },
            },
        });
    
        var assessment = new Aws.Inspector.AssessmentTarget("assessment", new()
        {
            Name = "test",
            ResourceGroupArn = @group.Arn,
        });
    
        var assessmentAssessmentTemplate = new Aws.Inspector.AssessmentTemplate("assessment", new()
        {
            Name = "Test",
            TargetArn = assessment.Arn,
            Duration = 60,
            RulesPackageArns = rules.Apply(getRulesPackagesResult => getRulesPackagesResult.Arns),
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.inspector.InspectorFunctions;
    import com.pulumi.aws.inspector.ResourceGroup;
    import com.pulumi.aws.inspector.ResourceGroupArgs;
    import com.pulumi.aws.inspector.AssessmentTarget;
    import com.pulumi.aws.inspector.AssessmentTargetArgs;
    import com.pulumi.aws.inspector.AssessmentTemplate;
    import com.pulumi.aws.inspector.AssessmentTemplateArgs;
    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) {
            // Declare the data source
            final var rules = InspectorFunctions.getRulesPackages();
    
            // e.g., Use in aws_inspector_assessment_template
            var group = new ResourceGroup("group", ResourceGroupArgs.builder()
                .tags(Map.of("test", "test"))
                .build());
    
            var assessment = new AssessmentTarget("assessment", AssessmentTargetArgs.builder()
                .name("test")
                .resourceGroupArn(group.arn())
                .build());
    
            var assessmentAssessmentTemplate = new AssessmentTemplate("assessmentAssessmentTemplate", AssessmentTemplateArgs.builder()
                .name("Test")
                .targetArn(assessment.arn())
                .duration("60")
                .rulesPackageArns(rules.applyValue(getRulesPackagesResult -> getRulesPackagesResult.arns()))
                .build());
    
        }
    }
    
    resources:
      # e.g., Use in aws_inspector_assessment_template
      group:
        type: aws:inspector:ResourceGroup
        properties:
          tags:
            test: test
      assessment:
        type: aws:inspector:AssessmentTarget
        properties:
          name: test
          resourceGroupArn: ${group.arn}
      assessmentAssessmentTemplate:
        type: aws:inspector:AssessmentTemplate
        name: assessment
        properties:
          name: Test
          targetArn: ${assessment.arn}
          duration: '60'
          rulesPackageArns: ${rules.arns}
    variables:
      # Declare the data source
      rules:
        fn::invoke:
          Function: aws:inspector:getRulesPackages
          Arguments: {}
    

    Using getRulesPackages

    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 getRulesPackages(opts?: InvokeOptions): Promise<GetRulesPackagesResult>
    function getRulesPackagesOutput(opts?: InvokeOptions): Output<GetRulesPackagesResult>
    def get_rules_packages(opts: Optional[InvokeOptions] = None) -> GetRulesPackagesResult
    def get_rules_packages_output(opts: Optional[InvokeOptions] = None) -> Output[GetRulesPackagesResult]
    func GetRulesPackages(ctx *Context, opts ...InvokeOption) (*GetRulesPackagesResult, error)
    func GetRulesPackagesOutput(ctx *Context, opts ...InvokeOption) GetRulesPackagesResultOutput

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

    public static class GetRulesPackages 
    {
        public static Task<GetRulesPackagesResult> InvokeAsync(InvokeOptions? opts = null)
        public static Output<GetRulesPackagesResult> Invoke(InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetRulesPackagesResult> getRulesPackages(InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: aws:inspector/getRulesPackages:getRulesPackages
      arguments:
        # arguments dictionary

    getRulesPackages Result

    The following output properties are available:

    Arns List<string>
    List of the Amazon Inspector Classic Rules Packages arns available in the AWS region.
    Id string
    The provider-assigned unique ID for this managed resource.
    Arns []string
    List of the Amazon Inspector Classic Rules Packages arns available in the AWS region.
    Id string
    The provider-assigned unique ID for this managed resource.
    arns List<String>
    List of the Amazon Inspector Classic Rules Packages arns available in the AWS region.
    id String
    The provider-assigned unique ID for this managed resource.
    arns string[]
    List of the Amazon Inspector Classic Rules Packages arns available in the AWS region.
    id string
    The provider-assigned unique ID for this managed resource.
    arns Sequence[str]
    List of the Amazon Inspector Classic Rules Packages arns available in the AWS region.
    id str
    The provider-assigned unique ID for this managed resource.
    arns List<String>
    List of the Amazon Inspector Classic Rules Packages arns available in the AWS region.
    id String
    The provider-assigned unique ID for this managed resource.

    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

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi