hashicorp / terraform-provider-awscc

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

awscc_cloudformation_guard_hook: target_operations doesn't support CLOUD_CONTROL #2112

Open quixoticmonk opened 7 hours ago

quixoticmonk commented 7 hours ago

Community Note

Terraform CLI and Terraform AWS Cloud Control Provider Version

Terraform v1.10.0-beta1
on darwin_amd64
+ provider registry.terraform.io/hashicorp/awscc v1.21.0

Affected Resource(s)

Terraform Configuration Files

Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.

resource "awscc_cloudformation_guard_hook" "example" {
  alias = "AWSCC::S3::Hooks"
  rule_location = {
    uri = "s3://ccapihooks/safebucket.guard"
  }
  execution_role    = awscc_iam_role.example.arn
  failure_mode      = "FAIL"
  target_operations = ["CLOUD_CONTROL"]
  hook_status       = "ENABLED"
  target_filters = {
    actions           = ["CREATE", "UPDATE"]
    invocation_points = ["PRE_PROVISION"]
    target_names      = ["AWS::S3::Bucket"]
  }

}

Expected Behavior

Actual Behavior

╷
│ Error: Invalid Attribute Value Match
│
│   with awscc_cloudformation_guard_hook.example,
│   on main.tf line 8, in resource "awscc_cloudformation_guard_hook" "example":
│    8:   target_operations = ["CLOUD_CONTROL"]
│
│ Attribute target_operations[0] value must be one of: ["RESOURCE" "STACK" "CHANGE_SET"], got: "CLOUD_CONTROL"

Steps to Reproduce

  1. terraform apply with an execution role and a guard rule saved in an S3 bucket.

Important Factoids

TargetOperations
Specifies which type of operation the Hook is run against.

Valid values: STACK | RESOURCE | CHANGE_SET | CLOUD_CONTROL


### References
quixoticmonk commented 7 hours ago

This applies to the awscc_cloudformation_lambda_hook as well : https://github.com/hashicorp/terraform-provider-awscc/blob/main/internal/service/cloudformation/schemas/AWS_CloudFormation_LambdaHook.json#L18-L26