github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/securityhub/standardsControl.go (about)

     1  // Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
     2  // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
     3  
     4  package securityhub
     5  
     6  import (
     7  	"context"
     8  	"reflect"
     9  
    10  	"errors"
    11  	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
    12  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    13  )
    14  
    15  // Disable/enable Security Hub standards control in the current region.
    16  //
    17  // The `securityhub.StandardsControl` behaves differently from normal resources, in that
    18  // Pulumi does not _create_ this resource, but instead "adopts" it
    19  // into management. When you _delete_ this resource configuration, Pulumi "abandons" resource as is and just removes it from the state.
    20  //
    21  // ## Example Usage
    22  //
    23  // <!--Start PulumiCodeChooser -->
    24  // ```go
    25  // package main
    26  //
    27  // import (
    28  //
    29  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/securityhub"
    30  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    31  //
    32  // )
    33  //
    34  //	func main() {
    35  //		pulumi.Run(func(ctx *pulumi.Context) error {
    36  //			example, err := securityhub.NewAccount(ctx, "example", nil)
    37  //			if err != nil {
    38  //				return err
    39  //			}
    40  //			cisAwsFoundationsBenchmark, err := securityhub.NewStandardsSubscription(ctx, "cis_aws_foundations_benchmark", &securityhub.StandardsSubscriptionArgs{
    41  //				StandardsArn: pulumi.String("arn:aws:securityhub:::ruleset/cis-aws-foundations-benchmark/v/1.2.0"),
    42  //			}, pulumi.DependsOn([]pulumi.Resource{
    43  //				example,
    44  //			}))
    45  //			if err != nil {
    46  //				return err
    47  //			}
    48  //			_, err = securityhub.NewStandardsControl(ctx, "ensure_iam_password_policy_prevents_password_reuse", &securityhub.StandardsControlArgs{
    49  //				StandardsControlArn: pulumi.String("arn:aws:securityhub:us-east-1:111111111111:control/cis-aws-foundations-benchmark/v/1.2.0/1.10"),
    50  //				ControlStatus:       pulumi.String("DISABLED"),
    51  //				DisabledReason:      pulumi.String("We handle password policies within Okta"),
    52  //			}, pulumi.DependsOn([]pulumi.Resource{
    53  //				cisAwsFoundationsBenchmark,
    54  //			}))
    55  //			if err != nil {
    56  //				return err
    57  //			}
    58  //			return nil
    59  //		})
    60  //	}
    61  //
    62  // ```
    63  // <!--End PulumiCodeChooser -->
    64  type StandardsControl struct {
    65  	pulumi.CustomResourceState
    66  
    67  	// The identifier of the security standard control.
    68  	ControlId pulumi.StringOutput `pulumi:"controlId"`
    69  	// The control status could be `ENABLED` or `DISABLED`. You have to specify `disabledReason` argument for `DISABLED` control status.
    70  	ControlStatus pulumi.StringOutput `pulumi:"controlStatus"`
    71  	// The date and time that the status of the security standard control was most recently updated.
    72  	ControlStatusUpdatedAt pulumi.StringOutput `pulumi:"controlStatusUpdatedAt"`
    73  	// The standard control longer description. Provides information about what the control is checking for.
    74  	Description pulumi.StringOutput `pulumi:"description"`
    75  	// A description of the reason why you are disabling a security standard control. If you specify this attribute, `controlStatus` will be set to `DISABLED` automatically.
    76  	DisabledReason pulumi.StringOutput `pulumi:"disabledReason"`
    77  	// The list of requirements that are related to this control.
    78  	RelatedRequirements pulumi.StringArrayOutput `pulumi:"relatedRequirements"`
    79  	// A link to remediation information for the control in the Security Hub user documentation.
    80  	RemediationUrl pulumi.StringOutput `pulumi:"remediationUrl"`
    81  	// The severity of findings generated from this security standard control.
    82  	SeverityRating pulumi.StringOutput `pulumi:"severityRating"`
    83  	// The standards control ARN. See the AWS documentation for how to list existing controls using [`get-enabled-standards`](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/securityhub/get-enabled-standards.html) and [`describe-standards-controls`](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/securityhub/describe-standards-controls.html).
    84  	StandardsControlArn pulumi.StringOutput `pulumi:"standardsControlArn"`
    85  	// The standard control title.
    86  	Title pulumi.StringOutput `pulumi:"title"`
    87  }
    88  
    89  // NewStandardsControl registers a new resource with the given unique name, arguments, and options.
    90  func NewStandardsControl(ctx *pulumi.Context,
    91  	name string, args *StandardsControlArgs, opts ...pulumi.ResourceOption) (*StandardsControl, error) {
    92  	if args == nil {
    93  		return nil, errors.New("missing one or more required arguments")
    94  	}
    95  
    96  	if args.ControlStatus == nil {
    97  		return nil, errors.New("invalid value for required argument 'ControlStatus'")
    98  	}
    99  	if args.StandardsControlArn == nil {
   100  		return nil, errors.New("invalid value for required argument 'StandardsControlArn'")
   101  	}
   102  	opts = internal.PkgResourceDefaultOpts(opts)
   103  	var resource StandardsControl
   104  	err := ctx.RegisterResource("aws:securityhub/standardsControl:StandardsControl", name, args, &resource, opts...)
   105  	if err != nil {
   106  		return nil, err
   107  	}
   108  	return &resource, nil
   109  }
   110  
   111  // GetStandardsControl gets an existing StandardsControl resource's state with the given name, ID, and optional
   112  // state properties that are used to uniquely qualify the lookup (nil if not required).
   113  func GetStandardsControl(ctx *pulumi.Context,
   114  	name string, id pulumi.IDInput, state *StandardsControlState, opts ...pulumi.ResourceOption) (*StandardsControl, error) {
   115  	var resource StandardsControl
   116  	err := ctx.ReadResource("aws:securityhub/standardsControl:StandardsControl", name, id, state, &resource, opts...)
   117  	if err != nil {
   118  		return nil, err
   119  	}
   120  	return &resource, nil
   121  }
   122  
   123  // Input properties used for looking up and filtering StandardsControl resources.
   124  type standardsControlState struct {
   125  	// The identifier of the security standard control.
   126  	ControlId *string `pulumi:"controlId"`
   127  	// The control status could be `ENABLED` or `DISABLED`. You have to specify `disabledReason` argument for `DISABLED` control status.
   128  	ControlStatus *string `pulumi:"controlStatus"`
   129  	// The date and time that the status of the security standard control was most recently updated.
   130  	ControlStatusUpdatedAt *string `pulumi:"controlStatusUpdatedAt"`
   131  	// The standard control longer description. Provides information about what the control is checking for.
   132  	Description *string `pulumi:"description"`
   133  	// A description of the reason why you are disabling a security standard control. If you specify this attribute, `controlStatus` will be set to `DISABLED` automatically.
   134  	DisabledReason *string `pulumi:"disabledReason"`
   135  	// The list of requirements that are related to this control.
   136  	RelatedRequirements []string `pulumi:"relatedRequirements"`
   137  	// A link to remediation information for the control in the Security Hub user documentation.
   138  	RemediationUrl *string `pulumi:"remediationUrl"`
   139  	// The severity of findings generated from this security standard control.
   140  	SeverityRating *string `pulumi:"severityRating"`
   141  	// The standards control ARN. See the AWS documentation for how to list existing controls using [`get-enabled-standards`](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/securityhub/get-enabled-standards.html) and [`describe-standards-controls`](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/securityhub/describe-standards-controls.html).
   142  	StandardsControlArn *string `pulumi:"standardsControlArn"`
   143  	// The standard control title.
   144  	Title *string `pulumi:"title"`
   145  }
   146  
   147  type StandardsControlState struct {
   148  	// The identifier of the security standard control.
   149  	ControlId pulumi.StringPtrInput
   150  	// The control status could be `ENABLED` or `DISABLED`. You have to specify `disabledReason` argument for `DISABLED` control status.
   151  	ControlStatus pulumi.StringPtrInput
   152  	// The date and time that the status of the security standard control was most recently updated.
   153  	ControlStatusUpdatedAt pulumi.StringPtrInput
   154  	// The standard control longer description. Provides information about what the control is checking for.
   155  	Description pulumi.StringPtrInput
   156  	// A description of the reason why you are disabling a security standard control. If you specify this attribute, `controlStatus` will be set to `DISABLED` automatically.
   157  	DisabledReason pulumi.StringPtrInput
   158  	// The list of requirements that are related to this control.
   159  	RelatedRequirements pulumi.StringArrayInput
   160  	// A link to remediation information for the control in the Security Hub user documentation.
   161  	RemediationUrl pulumi.StringPtrInput
   162  	// The severity of findings generated from this security standard control.
   163  	SeverityRating pulumi.StringPtrInput
   164  	// The standards control ARN. See the AWS documentation for how to list existing controls using [`get-enabled-standards`](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/securityhub/get-enabled-standards.html) and [`describe-standards-controls`](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/securityhub/describe-standards-controls.html).
   165  	StandardsControlArn pulumi.StringPtrInput
   166  	// The standard control title.
   167  	Title pulumi.StringPtrInput
   168  }
   169  
   170  func (StandardsControlState) ElementType() reflect.Type {
   171  	return reflect.TypeOf((*standardsControlState)(nil)).Elem()
   172  }
   173  
   174  type standardsControlArgs struct {
   175  	// The control status could be `ENABLED` or `DISABLED`. You have to specify `disabledReason` argument for `DISABLED` control status.
   176  	ControlStatus string `pulumi:"controlStatus"`
   177  	// A description of the reason why you are disabling a security standard control. If you specify this attribute, `controlStatus` will be set to `DISABLED` automatically.
   178  	DisabledReason *string `pulumi:"disabledReason"`
   179  	// The standards control ARN. See the AWS documentation for how to list existing controls using [`get-enabled-standards`](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/securityhub/get-enabled-standards.html) and [`describe-standards-controls`](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/securityhub/describe-standards-controls.html).
   180  	StandardsControlArn string `pulumi:"standardsControlArn"`
   181  }
   182  
   183  // The set of arguments for constructing a StandardsControl resource.
   184  type StandardsControlArgs struct {
   185  	// The control status could be `ENABLED` or `DISABLED`. You have to specify `disabledReason` argument for `DISABLED` control status.
   186  	ControlStatus pulumi.StringInput
   187  	// A description of the reason why you are disabling a security standard control. If you specify this attribute, `controlStatus` will be set to `DISABLED` automatically.
   188  	DisabledReason pulumi.StringPtrInput
   189  	// The standards control ARN. See the AWS documentation for how to list existing controls using [`get-enabled-standards`](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/securityhub/get-enabled-standards.html) and [`describe-standards-controls`](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/securityhub/describe-standards-controls.html).
   190  	StandardsControlArn pulumi.StringInput
   191  }
   192  
   193  func (StandardsControlArgs) ElementType() reflect.Type {
   194  	return reflect.TypeOf((*standardsControlArgs)(nil)).Elem()
   195  }
   196  
   197  type StandardsControlInput interface {
   198  	pulumi.Input
   199  
   200  	ToStandardsControlOutput() StandardsControlOutput
   201  	ToStandardsControlOutputWithContext(ctx context.Context) StandardsControlOutput
   202  }
   203  
   204  func (*StandardsControl) ElementType() reflect.Type {
   205  	return reflect.TypeOf((**StandardsControl)(nil)).Elem()
   206  }
   207  
   208  func (i *StandardsControl) ToStandardsControlOutput() StandardsControlOutput {
   209  	return i.ToStandardsControlOutputWithContext(context.Background())
   210  }
   211  
   212  func (i *StandardsControl) ToStandardsControlOutputWithContext(ctx context.Context) StandardsControlOutput {
   213  	return pulumi.ToOutputWithContext(ctx, i).(StandardsControlOutput)
   214  }
   215  
   216  // StandardsControlArrayInput is an input type that accepts StandardsControlArray and StandardsControlArrayOutput values.
   217  // You can construct a concrete instance of `StandardsControlArrayInput` via:
   218  //
   219  //	StandardsControlArray{ StandardsControlArgs{...} }
   220  type StandardsControlArrayInput interface {
   221  	pulumi.Input
   222  
   223  	ToStandardsControlArrayOutput() StandardsControlArrayOutput
   224  	ToStandardsControlArrayOutputWithContext(context.Context) StandardsControlArrayOutput
   225  }
   226  
   227  type StandardsControlArray []StandardsControlInput
   228  
   229  func (StandardsControlArray) ElementType() reflect.Type {
   230  	return reflect.TypeOf((*[]*StandardsControl)(nil)).Elem()
   231  }
   232  
   233  func (i StandardsControlArray) ToStandardsControlArrayOutput() StandardsControlArrayOutput {
   234  	return i.ToStandardsControlArrayOutputWithContext(context.Background())
   235  }
   236  
   237  func (i StandardsControlArray) ToStandardsControlArrayOutputWithContext(ctx context.Context) StandardsControlArrayOutput {
   238  	return pulumi.ToOutputWithContext(ctx, i).(StandardsControlArrayOutput)
   239  }
   240  
   241  // StandardsControlMapInput is an input type that accepts StandardsControlMap and StandardsControlMapOutput values.
   242  // You can construct a concrete instance of `StandardsControlMapInput` via:
   243  //
   244  //	StandardsControlMap{ "key": StandardsControlArgs{...} }
   245  type StandardsControlMapInput interface {
   246  	pulumi.Input
   247  
   248  	ToStandardsControlMapOutput() StandardsControlMapOutput
   249  	ToStandardsControlMapOutputWithContext(context.Context) StandardsControlMapOutput
   250  }
   251  
   252  type StandardsControlMap map[string]StandardsControlInput
   253  
   254  func (StandardsControlMap) ElementType() reflect.Type {
   255  	return reflect.TypeOf((*map[string]*StandardsControl)(nil)).Elem()
   256  }
   257  
   258  func (i StandardsControlMap) ToStandardsControlMapOutput() StandardsControlMapOutput {
   259  	return i.ToStandardsControlMapOutputWithContext(context.Background())
   260  }
   261  
   262  func (i StandardsControlMap) ToStandardsControlMapOutputWithContext(ctx context.Context) StandardsControlMapOutput {
   263  	return pulumi.ToOutputWithContext(ctx, i).(StandardsControlMapOutput)
   264  }
   265  
   266  type StandardsControlOutput struct{ *pulumi.OutputState }
   267  
   268  func (StandardsControlOutput) ElementType() reflect.Type {
   269  	return reflect.TypeOf((**StandardsControl)(nil)).Elem()
   270  }
   271  
   272  func (o StandardsControlOutput) ToStandardsControlOutput() StandardsControlOutput {
   273  	return o
   274  }
   275  
   276  func (o StandardsControlOutput) ToStandardsControlOutputWithContext(ctx context.Context) StandardsControlOutput {
   277  	return o
   278  }
   279  
   280  // The identifier of the security standard control.
   281  func (o StandardsControlOutput) ControlId() pulumi.StringOutput {
   282  	return o.ApplyT(func(v *StandardsControl) pulumi.StringOutput { return v.ControlId }).(pulumi.StringOutput)
   283  }
   284  
   285  // The control status could be `ENABLED` or `DISABLED`. You have to specify `disabledReason` argument for `DISABLED` control status.
   286  func (o StandardsControlOutput) ControlStatus() pulumi.StringOutput {
   287  	return o.ApplyT(func(v *StandardsControl) pulumi.StringOutput { return v.ControlStatus }).(pulumi.StringOutput)
   288  }
   289  
   290  // The date and time that the status of the security standard control was most recently updated.
   291  func (o StandardsControlOutput) ControlStatusUpdatedAt() pulumi.StringOutput {
   292  	return o.ApplyT(func(v *StandardsControl) pulumi.StringOutput { return v.ControlStatusUpdatedAt }).(pulumi.StringOutput)
   293  }
   294  
   295  // The standard control longer description. Provides information about what the control is checking for.
   296  func (o StandardsControlOutput) Description() pulumi.StringOutput {
   297  	return o.ApplyT(func(v *StandardsControl) pulumi.StringOutput { return v.Description }).(pulumi.StringOutput)
   298  }
   299  
   300  // A description of the reason why you are disabling a security standard control. If you specify this attribute, `controlStatus` will be set to `DISABLED` automatically.
   301  func (o StandardsControlOutput) DisabledReason() pulumi.StringOutput {
   302  	return o.ApplyT(func(v *StandardsControl) pulumi.StringOutput { return v.DisabledReason }).(pulumi.StringOutput)
   303  }
   304  
   305  // The list of requirements that are related to this control.
   306  func (o StandardsControlOutput) RelatedRequirements() pulumi.StringArrayOutput {
   307  	return o.ApplyT(func(v *StandardsControl) pulumi.StringArrayOutput { return v.RelatedRequirements }).(pulumi.StringArrayOutput)
   308  }
   309  
   310  // A link to remediation information for the control in the Security Hub user documentation.
   311  func (o StandardsControlOutput) RemediationUrl() pulumi.StringOutput {
   312  	return o.ApplyT(func(v *StandardsControl) pulumi.StringOutput { return v.RemediationUrl }).(pulumi.StringOutput)
   313  }
   314  
   315  // The severity of findings generated from this security standard control.
   316  func (o StandardsControlOutput) SeverityRating() pulumi.StringOutput {
   317  	return o.ApplyT(func(v *StandardsControl) pulumi.StringOutput { return v.SeverityRating }).(pulumi.StringOutput)
   318  }
   319  
   320  // The standards control ARN. See the AWS documentation for how to list existing controls using [`get-enabled-standards`](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/securityhub/get-enabled-standards.html) and [`describe-standards-controls`](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/securityhub/describe-standards-controls.html).
   321  func (o StandardsControlOutput) StandardsControlArn() pulumi.StringOutput {
   322  	return o.ApplyT(func(v *StandardsControl) pulumi.StringOutput { return v.StandardsControlArn }).(pulumi.StringOutput)
   323  }
   324  
   325  // The standard control title.
   326  func (o StandardsControlOutput) Title() pulumi.StringOutput {
   327  	return o.ApplyT(func(v *StandardsControl) pulumi.StringOutput { return v.Title }).(pulumi.StringOutput)
   328  }
   329  
   330  type StandardsControlArrayOutput struct{ *pulumi.OutputState }
   331  
   332  func (StandardsControlArrayOutput) ElementType() reflect.Type {
   333  	return reflect.TypeOf((*[]*StandardsControl)(nil)).Elem()
   334  }
   335  
   336  func (o StandardsControlArrayOutput) ToStandardsControlArrayOutput() StandardsControlArrayOutput {
   337  	return o
   338  }
   339  
   340  func (o StandardsControlArrayOutput) ToStandardsControlArrayOutputWithContext(ctx context.Context) StandardsControlArrayOutput {
   341  	return o
   342  }
   343  
   344  func (o StandardsControlArrayOutput) Index(i pulumi.IntInput) StandardsControlOutput {
   345  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *StandardsControl {
   346  		return vs[0].([]*StandardsControl)[vs[1].(int)]
   347  	}).(StandardsControlOutput)
   348  }
   349  
   350  type StandardsControlMapOutput struct{ *pulumi.OutputState }
   351  
   352  func (StandardsControlMapOutput) ElementType() reflect.Type {
   353  	return reflect.TypeOf((*map[string]*StandardsControl)(nil)).Elem()
   354  }
   355  
   356  func (o StandardsControlMapOutput) ToStandardsControlMapOutput() StandardsControlMapOutput {
   357  	return o
   358  }
   359  
   360  func (o StandardsControlMapOutput) ToStandardsControlMapOutputWithContext(ctx context.Context) StandardsControlMapOutput {
   361  	return o
   362  }
   363  
   364  func (o StandardsControlMapOutput) MapIndex(k pulumi.StringInput) StandardsControlOutput {
   365  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *StandardsControl {
   366  		return vs[0].(map[string]*StandardsControl)[vs[1].(string)]
   367  	}).(StandardsControlOutput)
   368  }
   369  
   370  func init() {
   371  	pulumi.RegisterInputType(reflect.TypeOf((*StandardsControlInput)(nil)).Elem(), &StandardsControl{})
   372  	pulumi.RegisterInputType(reflect.TypeOf((*StandardsControlArrayInput)(nil)).Elem(), StandardsControlArray{})
   373  	pulumi.RegisterInputType(reflect.TypeOf((*StandardsControlMapInput)(nil)).Elem(), StandardsControlMap{})
   374  	pulumi.RegisterOutputType(StandardsControlOutput{})
   375  	pulumi.RegisterOutputType(StandardsControlArrayOutput{})
   376  	pulumi.RegisterOutputType(StandardsControlMapOutput{})
   377  }