-
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
azurerm_managed_application
- extend supported types for parameters
/parameter_values
/output
and deprecate parameters
#21541
Conversation
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 @myc2h6o - could you add a test to validate this?
Any updates @myc2h6o |
@stephybun I found some more issue while updating this pr, and I'm working on the update in a separate branch main...myc2h6o:terraform-provider-azurerm:managed_app_type_backup currently, I'll update it here once I resolved all the issues |
087cea1
to
cd10cd6
Compare
azurerm_managed_application
- fix parameter
typesazurerm_managed_application
- extend supported types for parameter_values
and output
azurerm_managed_application
- extend supported types for parameter_values
and output
azurerm_managed_application
- extend supported types for parameters
/parameter_values
and output
cd10cd6
to
830e765
Compare
Hi @stephybun sorry for the delayed update, I finally get this to work. I've updated the code and acc tests, and put the updated PR details into the pr descriptions, please take a look. |
#21571 should probably be merged first as it will be easier to fix conflicts in this PR then that one |
@katbyte sure, I'll wait for the sdk to be upgraded first |
6e03df4
to
b09176c
Compare
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 updating and adding the tests @myc2h6o. I think this mostly looks good, just a couple of potential crashes I spotted, and given the messiness of this double implementation I wonder if we should consider deprecating parameters
with a view to removing it in v4.0? Although it's an attempt at a more native implementation, it currently has to coexist with parameter_values
because it's only a subset - we can avoid a lot of unnecessary gymnastics here by removing it. WDYT?
// Secure values are not returned, thus settings it with local value | ||
v = "" | ||
if oldValueStruct, oldValueStructOK := localParameters[k]; oldValueStructOK { | ||
if oldValue, oldValueOK := oldValueStruct.(map[string]interface{})["value"]; oldValueOK { |
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.
I think we'll need some type-checking here because oldValueStruct
is an interface{}
and no guarantee that it will be a map? If it isn't, this will panic
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.
yes make sense, have added the type check
if _, ok := value["value"]; !ok { | ||
value["value"] = "" | ||
if localParam, localParamOK := localParameters[k]; localParamOK { | ||
if localParamValue, localParamValueOK := localParam.(map[string]interface{})["value"]; localParamValueOK { |
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.
As above, we should add more type-checking here
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.
yes make sense, have added the type check
azurerm_managed_application
- extend supported types for parameters
/parameter_values
and output
azurerm_managed_application
- extend supported types for parameters
/parameter_values
and output
and deprecate parameters
@manicminer thanks for reviewing the change! I've updated the code to deprecate |
557e0ad
to
63238af
Compare
have rebased to main to resolve ci failure of the example issue fixed by #22839 |
azurerm_managed_application
- extend supported types for parameters
/parameter_values
and output
and deprecate parameters
azurerm_managed_application
- extend supported types for parameters
/parameter_values
/output
and deprecate parameters
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 updating @myc2h6o, this LGTM 👍
internal/services/managedapplications/managed_application_resource_test.go
Outdated
Show resolved
Hide resolved
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 contributions. |
Fix #21267
Fix #13427
Fix #20016
outputs
does not support secureString butparameters
does. And moved common logic into functions.expandManagedApplicationParameters
, previously it always read the value fromparameters
afterparameter_values
, which will cause an issue when updatingparameter_values
, because on the second apply, evenparameter
is not set in config, it's still present in the state from the first apply.ForceNew
toplan
, plan cannot be changed according to error returned by serviceCode="CannotUpdatePlan"
.parameters
, it only supports string and secureString due to the limitation of tf schema, for other types,parmeter_values
could be used as it is a pure JSON stringazurerm_managed_application_definition
to use inline template as dependency instead of online template to ensure stabilityparameters
andparameter_values
parameters
andparameter_values
, to show how to set parameters of different types.