英文:
Terraform - AWS - TypeError: planResultMessage.search is not a function
问题
I've translated the non-code part of your message:
我已经思考了比我愿意承认的时间,但我现在打算放弃了...
我有一个大型的Terraform包,在Terraform计划中,我遇到了这个错误:
Terraform Plan (Error) 日志
计划中的异常错误 - TypeError:planResultMessage.search不是一个函数
我在我的代码中没有使用planResultMessage.search
,所以我猜这是一个Terraform错误?
我知道的是,它部署的这组资源是一堆yaml文档,我试图利用它们来创建SSM文档。它们被加载如下:
member_data.tf
data "template_file" "member_createmultiregiontrail" {
template = file("${path.module}/member-runbooks/member-asr-CreateCloudTrailMultiRegionTrail.yml")
}
data "template_file" "member_createlogmetricsfilteralarm" {
template = file("${path.module}/member-runbooks/member-asr-CreateLogMetricFilterAndAlarm.yml")
}
asr-member.tf
resource "aws_ssm_document" "asr_document_cloudtrail_multiregion" {
provider = aws.customer
count = var.enabled == true && var.child_account == true ? 1 : 0
name = "ASR-CreateCloudTrailMultiRegionTrail"
document_format = "YAML"
document_type = "Automation"
content = data.template_file.member_createmultiregiontrail.template
}
resource "aws_ssm_document" "asr_document_logs_metricsfilter_alarm" {
provider = aws.customer
count = var.enabled == true && var.child_account == true ? 1 : 0
name = "ASR-CreateLogMetricFilterAndAlarm"
document_format = "YAML"
document_type = "Automation"
content = data.template_file.member_createlogmetricsfilteralarm.template
}
作为一个例子。我认为原因可能在这些文档文件中,因为Terraform错误在这些文档的内容中间弹出,它总是在其中一个文档的随机位置...
这个错误出现在SecHub的AFSBP Redshift 6控制的文档中,但在部分内容的开头,它承认资源将被部署:
# module.aws-securityhub-master.aws_ssm_document.AFSBP_Redshift_6[0]将被创建
我已经尝试了直接加载内容,使用yamlencode,仅使用"file",加载到本地,从本地提取文件,现在我正在使用数据源。
如果有人能提供任何帮助,将不胜感激。
免责声明:
这个Terraform构建是Amazon的SHARR解决方案的解构:
https://aws.amazon.com/solutions/implementations/automated-security-response-on-aws/
您可以在这里看到基于哪个安全控制的各种yaml构建:
我在我的数据源中明确指出的两个是:
和
以及AFSBP的yaml可以在这里找到(以防有关系):
提前感谢您!
英文:
I've been scratching my head over this one for longer than I'd like to admit, but I'm throwing in the towel...
I have a large Terraform package and in the Terraform Plan, I get this error:
Terraform Plan (Error) Log
Exception Error in plan - TypeError: planResultMessage.search is not a function
I do not use the planResultMessage.search
anywhere in my code, so my guess is that it is a Terraform error?
What I do know is that this set of resources that it is deploying is a bunch of yaml documents that I am trying to leverage to create SSM Documents. They are being loaded as such:
member_data.tf
data "template_file" "member_createmultiregiontrail" {
template = file("${path.module}/member-runbooks/member-asr-CreateCloudTrailMultiRegionTrail.yml")
}
data "template_file" "member_createlogmetricsfilteralarm" {
template = file("${path.module}/member-runbooks/member-asr-CreateLogMetricFilterAndAlarm.yml")
}
asr-member.tf
resource "aws_ssm_document" "asr_document_cloudtrail_multiregion" {
provider = aws.customer
count = var.enabled == true && var.child_account == true ? 1 : 0
name = "ASR-CreateCloudTrailMultiRegionTrail"
document_format = "YAML"
document_type = "Automation"
content = data.template_file.member_createmultiregiontrail.template
}
resource "aws_ssm_document" "asr_document_logs_metricsfilter_alarm" {
provider = aws.customer
count = var.enabled == true && var.child_account == true ? 1 : 0
name = "ASR-CreateLogMetricFilterAndAlarm"
document_format = "YAML"
document_type = "Automation"
content = data.template_file.member_createlogmetricsfilteralarm.template
}
As an example. I think the cause might be in these document files because the Terraform Error populates in the middle of the contents of these documents, it's always a random location in one of the documents...
This one fell into a document for SecHub's AFSBP Redshift 6 control, but at the beginning of the section contents it acknowledges that the resource will be deployed:
# module.aws-securityhub-master.aws_ssm_document.AFSBP_Redshift_6[0] will be created
I have tried loading the contents directly, using yamlencode, using simply "file", loading them into locals, pulling a file from locals, and now I'm on data sources.
If anyone can offer any help, it would be greatly appreciated.
DISCLAIMER:
This Terraform build out is a deconstruction of Amazon's SHARR solution:
https://aws.amazon.com/solutions/implementations/automated-security-response-on-aws/
you can see the various yaml build-outs here based on which security control:
The two that I specifically called out in my data sources are:
and
and the AFSBP yaml can be found here (just in case it matters):
Thank you in advance!
答案1
得分: 0
这是一个缓冲区溢出问题。扩展资源以适应部署,问题得以解决。
英文:
This turned out to be a buffer overflow issue. Expanded resources to accommodate the deployment and that solved the issue.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论