hashicorp / terraform-provider-awscc

Terraform AWS Cloud Control provider
https://registry.terraform.io/providers/hashicorp/awscc/latest/docs
Mozilla Public License 2.0
258 stars 117 forks source link

awscc_inspectorv2_cis_scan_configuration: optional key targets is required in plan/apply #1747

Open quixoticmonk opened 5 months ago

quixoticmonk commented 5 months ago

Community Note

Terraform CLI and Terraform AWS Cloud Control Provider Version

terraform -v
Terraform v1.7.4
on darwin_amd64
+ provider registry.terraform.io/hashicorp/aws v5.50.0
+ provider registry.terraform.io/hashicorp/awscc v0.78.0

Affected Resource(s)

Terraform Configuration Files

Based on the scan configuration input, every input is optional. For example, with the configuration below where targets is not provided , terraform apply fails.


resource "awscc_inspectorv2_cis_scan_configuration" "example" {
  scan_name = "example"
  schedule = {
    daily = {
      start_time = {
        time_of_day = "00:00"
        time_zone   = "UTC"
      }
    }
  }
  security_level = "LEVEL_1"
  tags = {
   "Modified By"= "AWSCC"
  }
}

Debug Output

Panic Output

Expected Behavior

Actual Behavior

With targets missing :

β•·
β”‚ Error: AWS SDK Go Service Operation Incomplete
β”‚
β”‚   with awscc_inspectorv2_cis_scan_configuration.example,
β”‚   on main.tf line 1, in resource "awscc_inspectorv2_cis_scan_configuration" "example":
β”‚    1: resource "awscc_inspectorv2_cis_scan_configuration" "example" {
β”‚
β”‚ Waiting for Cloud Control API service CreateResource operation completion
β”‚ returned: waiter state transitioned to FAILED. StatusMessage: 1 validation
β”‚ error detected: Value at 'targets' failed to satisfy constraint: Member must
β”‚ not be null (Service: Inspector2, Status Code: 400, Request ID:
β”‚ df786bf8-789d-4fd4-8c2c-4153a8c9568c). ErrorCode: InvalidRequest

With all missing :

β•·
β”‚ Error: AWS SDK Go Service Operation Incomplete
β”‚
β”‚   with awscc_inspectorv2_cis_scan_configuration.example,
β”‚   on main.tf line 1, in resource "awscc_inspectorv2_cis_scan_configuration" "example":
β”‚    1: resource "awscc_inspectorv2_cis_scan_configuration" "example" {
β”‚
β”‚ Waiting for Cloud Control API service CreateResource operation completion
β”‚ returned: waiter state transitioned to FAILED. StatusMessage: 4 validation
β”‚ errors detected: Value at 'securityLevel' failed to satisfy constraint:
β”‚ Member must not be null; Value at 'schedule' failed to satisfy constraint:
β”‚ Member must not be null; Value at 'scanName' failed to satisfy constraint:
β”‚ Member must not be null; Value at 'targets' failed to satisfy constraint:
β”‚ Member must not be null (Service: Inspector2, Status Code: 400, Request ID:
β”‚ c4a8eb98-e631-430c-a5ce-406a89897f56). ErrorCode: InvalidRequest

Steps to Reproduce

  1. terraform apply

Important Factoids

References

quixoticmonk commented 5 months ago

Opened an internal AWS service ticket for the schema.