Closed diomalta closed 1 year ago
Please provide a reproduction that demonstrates the issue first so we can discuss any changes
I'm sorry, first time...
This is sample code to demonstrate the problem:
module "app_runner_private_image_base" {
source = "terraform-aws-modules/app-runner/aws"
version = "1.2.0"
service_name = "test-private-image-base"
source_configuration = {
auto_deployments_enabled = false
image_repository = {
image_configuration = {
port = 8000
runtime_environment_variables = {
MY_VARIABLE = "hello!"
}
}
image_repository_type = "ECR"
image_identifier = "123456789012.dkr.ecr.us-east-1.amazonaws.com/example-server:latest"
}
}
create_access_iam_role = true
private_ecr_arn = "arn:aws:ecr:us-east-1:123456789012:repository/example-server"
auto_scaling_configurations = {
mini = {
name = "mini"
max_concurrency = 20
max_size = 5
min_size = 1
tags = {
Type = "Mini"
}
}
}
}
The output of the Terraform plan:
Error: Inconsistent conditional result types
β
β on .terraform/modules/app_runner_private_image_base/main.tf line 17, in locals:
β 17: source_configuration = local.create_access_iam_role ? merge(
β 18: var.source_configuration,
β 19: { authentication_configuration = { access_role_arn = aws_iam_role.access[0].arn } }
β 20: ) : var.source_configuration
β βββββββββββββββββ
β β aws_iam_role.access[0].arn is a string
β β local.create_access_iam_role is true
β β var.source_configuration is object with 2 attributes
β
β The true and false result expressions must have consistent types. The 'true' value includes object attribute "authentication_configuration", which is absent in the 'false' value.
Provider version (AWS): 4.62.0
Is more information needed?
This PR has been automatically marked as stale because it has been open 30 days with no activity. Remove stale label or comment or this PR will be closed in 10 days
this can be solved by #7 if we default the property authentication_configuration
in that object to null, right? or maybe an empty map.
IIRC this error message comes from terraform defaulting to deep-merging maps, not sure if it's even configurable to not deep merge.
tested, authentication_configuration = null
does fix this
Had the same issue and @kevcube solution worked.
This PR has been automatically marked as stale because it has been open 30 days with no activity. Remove stale label or comment or this PR will be closed in 10 days
This PR was automatically closed because of stale in 10 days
I'm going to lock this pull request 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 related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Description
This pull request aims to fix an issue when configuring a custom access role for AWS App Runner, where the Terraform merge function would return an "Inconsistent conditional result types fail for complex types" error. This occurred because the possibility of adding more attributes in a map was not being handled properly.
Motivation and Context
This change is required to ensure that users can configure custom access roles for AWS App Runner without encountering errors during the merge function. By handling the addition of more attributes in a map, the Terraform configuration will now function correctly and prevent the aforementioned error.
Breaking Changes
There are no breaking changes in this pull request. The changes are solely focused on resolving the issue mentioned above.
How Has This Been Tested?
examples/*
to demonstrate and validate my change(s)examples/*
projectspre-commit run -a
on my pull requestTo test these changes, I started with an existing example from the examples/* folder and deployed it. Then, I applied my changes and checked it against the deployed example to ensure there were no breaking or disruptive changes. Once verified, I deployed the changes again to validate their functionality. Finally, I executed pre-commit run -a on my pull request to ensure compliance with pre-commit standards.