driftctl
driftctl copied to clipboard
Default aws_api_gateway_models need to be ignored as they can't be managed.
Description
Creating a terraform resource to try to manage the default aws_api_gateway_models, results in error when creating the api gateways.
Environment
- OS: Linux
- driftctl version: v0.38.2)
- terraform version: 0.13.5
- terraform providers versions:
- provider registry.terraform.io/hashicorp/aws v4.55.0
- provider registry.terraform.io/hashicorp/local v2.3.0
- provider registry.terraform.io/hashicorp/template v2.2.0
How to reproduce
resource aws_api_gateway_rest_api apigw_rest {
name = "test-apigw"
description = var.description
endpoint_configuration {
types = ["REGIONAL"]
}
tags = merge(var.common_tags, {
description = var.description
})
}
# explicitly manage the default models
resource aws_api_gateway_model error {
rest_api_id = aws_api_gateway_rest_api.apigw_rest.id
name = "Error"
description = "This is a default error schema model "
content_type = "application/json"
schema = <<-EOF
{
"type": "object"
}
EOF
}
resource aws_api_gateway_model empty {
rest_api_id = aws_api_gateway_rest_api.apigw_rest.id
name = "Empty"
description = "This is a default error schema model "
content_type = "application/json"
schema = <<-EOF
{
"type": "object"
}
EOF
}
Possible Solution
Ignore default models in middleware.
Additional context
Error: creating API Gateway Model (Error): ConflictException: Model name already exists for this REST API
on test.tf line 15, in resource "aws_api_gateway_model" "error":
15: resource aws_api_gateway_model error {
Error: creating API Gateway Model (Empty): ConflictException: Model name already exists for this REST API
on test.tf line 28, in resource "aws_api_gateway_model" "empty":
28: resource aws_api_gateway_model empty {