-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Made the app_port property in the dapr block of the azurerm_container_app resource optional #20567
Conversation
Cc: @lonegunmanb |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A suggestion on your pr @paolosalvatori
@lonegunmanb I successfully tested the change locally by deploying a container app with no |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this PR @paolosalvatori!
Could you add a test where app_port
is omitted so that we can test this behaviour? I also suspect that changes will need to be made to the expand/flatten functions for this block to conditionally set this property if it's been specified.
terraform-provider-azurerm/internal/services/containerapps/helpers/container_apps.go
Lines 426 to 462 in c67a180
func ExpandContainerAppDapr(input []Dapr) *containerapps.Dapr { | |
if len(input) == 0 { | |
return nil | |
} | |
dapr := input[0] | |
if dapr.AppId == "" { | |
return &containerapps.Dapr{ | |
Enabled: pointer.To(false), | |
} | |
} | |
appProtocol := containerapps.AppProtocol(dapr.AppProtocol) | |
return &containerapps.Dapr{ | |
AppId: pointer.To(dapr.AppId), | |
AppPort: pointer.To(int64(dapr.AppPort)), | |
AppProtocol: &appProtocol, | |
Enabled: pointer.To(true), | |
} | |
} | |
func FlattenContainerAppDapr(input *containerapps.Dapr) []Dapr { | |
if input == nil { | |
return []Dapr{} | |
} | |
result := Dapr{ | |
AppId: pointer.From(input.AppId), | |
AppPort: int(pointer.From(input.AppPort)), | |
} | |
if appProtocol := input.AppProtocol; appProtocol != nil { | |
result.AppProtocol = string(*appProtocol) | |
} | |
return []Dapr{result} | |
} |
Hi @stephybun, yesterday I successfully tested the change locally without the need to make any change in the
The In my last commit, I added a new test function called |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @paolosalvatori - LGTM 🦕
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
THanks @paolosalvatori ! LGTM 🥡
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Hi @jackofallops / @katbyte I added the following functions. Please let me know if this is what you have in mind. If not, please suggest a code change. I'm deploying the complete configuration as a baseline, then I remove the dapr.app_port and finally check that its value is empty.
|
Hi @jackofallops / @katbyte can you please review my change and let me know if it works? I couldn't test the latest test function. |
This comment was marked as off-topic.
This comment was marked as off-topic.
Co-authored-by: jackofallops <[email protected]>
@stephybun I committed your suggestion, thanks! |
@paolosalvatori - looks like the test check is failing with
should just need to update the test check? |
@katbyte @jackofallops can you please check the PR now? It looks to me that now all the tests succeed |
Hi @paolosalvatori - I think the most recent change is incorrect, it refers to an invalid path so is not testing the correct item, and should be:
as an empty value for that property in state would be '0'. If you can update that, I'll run this through our CI again and I think we'll be good to go. Thanks! |
Hi @jackofallops please check now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @paolosalvatori ! tests pass now LGTM 🚟
Thanks @katbyte / @jackofallops for the collaboration. |
This functionality has been released in v3.51.0 of the Terraform 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! |
This pull request makes the
app_port
property in thedapr
block of theazurerm_container_app
resource should optional instead of required. As explained in the related issue #20534, you should be able to set the value of this property tonull
to create headless applications, like thepythonapp
in the Tutorial: Deploy a Dapr application to Azure Container Apps with an Azure Resource Manager or Bicep template, with no ingress, hence with noapp_port
. This PR resolves #20534