Closed clement-cunin closed 7 months ago
Hey @clement-cunin 👋 Thank you for taking the time to raise this! So that we have all of the necessary information in order to look into this, can you supply debug logs (redacted as needed) as well?
I just reproduct with the last version of terraform:
Terraform v1.2.2
on windows_amd64
+ provider registry.terraform.io/hashicorp/aws v4.17.1
The debug log of AWS call:
2022-06-09T21:30:39.736+0200 [TRACE] provider.terraform-provider-aws_v4.17.1_x5.exe: Calling downstream: tf_provider_addr=provider tf_req_id=5d8df4b0-eeab-a207-bfa3-6f3b11174111 tf_resource_type=aws_config_config_rule tf_rpc=ApplyResourceChange @caller=github.com/hashicorp/terraform-plugin-sdk/v2@v2.16.0/helper/schema/resource.go:846 @module=sdk.helper_schema timestamp=2022-06-09T21:30:39.736+0200
2022-06-09T21:30:39.736+0200 [DEBUG] provider.terraform-provider-aws_v4.17.1_x5.exe: Creating AWSConfig config rule: {
ConfigRule: {
ConfigRuleName: "example",
Source: {
CustomPolicyDetails: {
EnableDebugLogDelivery: false,
PolicyRuntime: "guard-2.x.x",
PolicyText: ""
},
Owner: "CUSTOM_POLICY",
SourceDetails: [{
EventSource: "aws.config",
MessageType: "ConfigurationItemChangeNotification"
}]
}
},
Tags: [{
Key: "test",
Value: "sample2"
}]
}: timestamp=2022-06-09T21:30:39.736+0200
2022-06-09T21:30:39.736+0200 [DEBUG] provider.terraform-provider-aws_v4.17.1_x5.exe: Waiting for state to become: [success]: timestamp=2022-06-09T21:30:39.736+0200
2022-06-09T21:30:39.736+0200 [DEBUG] provider.terraform-provider-aws_v4.17.1_x5.exe: [aws-sdk-go] DEBUG: Request config/PutConfigRule Details:
---[ REQUEST POST-SIGN ]-----------------------------
POST / HTTP/1.1
Host: config.eu-west-1.amazonaws.com
User-Agent: APN/1.0 HashiCorp/1.0 Terraform/1.2.2 (+https://www.terraform.io) terraform-provider-aws/dev (+https://registry.terraform.io/providers/hashicorp/aws) aws-sdk-go/1.44.25 (go1.17.6; windows; amd64)
Content-Length: 320
Authorization: AWS4-HMAC-SHA256 Credential=AKIAUX4YUB3AXSLNSTEA/20220609/eu-west-1/config/aws4_request, SignedHeaders=content-length;content-type;host;x-amz-date;x-amz-target, Signature=5f09805f82cf08d51cdaefa1c1e8d9f084f0a068971c502c9a55969d125afaeb
Content-Type: application/x-amz-json-1.1
X-Amz-Date: 20220609T193039Z
X-Amz-Target: StarlingDoveService.PutConfigRule
Accept-Encoding: gzip
{"ConfigRule":{"ConfigRuleName":"example","Source":{"CustomPolicyDetails":{"EnableDebugLogDelivery":false,"PolicyRuntime":"guard-2.x.x","PolicyText":""},"Owner":"CUSTOM_POLICY","SourceDetails":[{"EventSource":"aws.config","MessageType":"ConfigurationItemChangeNotification"}]}},"Tags":[{"Key":"test","Value":"sample2"}]}
-----------------------------------------------------: timestamp=2022-06-09T21:30:39.736+0200
2022-06-09T21:30:39.854+0200 [DEBUG] provider.terraform-provider-aws_v4.17.1_x5.exe: [aws-sdk-go] DEBUG: Response config/PutConfigRule Details:
---[ RESPONSE ]--------------------------------------
HTTP/1.1 400 Bad Request
Connection: close
Content-Length: 106
Content-Type: application/x-amz-json-1.1
Date: Thu, 09 Jun 2022 19:30:39 GMT
Strict-Transport-Security: max-age=86400
X-Amzn-Requestid: bf07203f-bc64-4990-8896-1b25e292b41a
-----------------------------------------------------: timestamp=2022-06-09T21:30:39.854+0200
2022-06-09T21:30:39.854+0200 [DEBUG] provider.terraform-provider-aws_v4.17.1_x5.exe: [aws-sdk-go] {"__type":"InvalidParameterValueException","message":"PolicyText is required when Owner is CUSTOM_POLICY"}: timestamp=2022-06-09T21:30:39.854+0200
2022-06-09T21:30:39.854+0200 [DEBUG] provider.terraform-provider-aws_v4.17.1_x5.exe: [aws-sdk-go] DEBUG: Validate Response config/PutConfigRule failed, attempt 0/25, error InvalidParameterValueException: PolicyText is required when Owner is CUSTOM_POLICY: timestamp=2022-06-09T21:30:39.854+0200
Bug is still reproducable: Terraform v1.6.6 on linux_amd64
This functionality has been released in v5.39.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.
For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Community Note
Terraform CLI and Terraform AWS Provider Version
Affected Resource(s)
Terraform Configuration Files
Start with custom config rule as defined in documentation (with tags)
Panic Output
Error creating AWSConfig rule: Failed to create AWSConfig rule: InvalidParameterValueException: PolicyText is required when Owner is CUSTOM_POLICY
Actual Behavior
The first terraform apply work's fine to create the AWSConfig custom rule. But if try to update the tag value, terraform fail to apply change on it.
Expected Behavior
Terraform should be able to update tags on AWSCustom rule
Steps to Reproduce
terraform apply
terraform apply
Important Factoids
/
References