-
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
New resource & data source: azurerm_managed_application_definition #6211
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 PR!
I've taken a look through and left some comments inline, but this is mostly looking good to me 👍
azurerm/internal/services/managedapplication/data_source_managed_application_definition.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/managedapplication/data_source_managed_application_definition.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/managedapplication/data_source_managed_application_definition.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/managedapplication/resource_arm_managed_application_definition.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/managedapplication/resource_arm_managed_application_definition.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/managedapplication/validate/managed_application_definition_test.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/managedapplication/validate/managed_application_definition_test.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/managedapplication/parse/managed_application_definition_test.go
Outdated
Show resolved
Hide resolved
@magodo , Thanks for your comments. I've updated code. Please have a look. |
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 have left some additional mostly minor comments that once addressed this should be good to merge 👍
azurerm/internal/services/managedapplication/parse/managed_application_definition_test.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/managedapplication/resource_arm_managed_application_definition.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/managedapplication/resource_arm_managed_application_definition.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/managedapplication/resource_arm_managed_application_definition.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/managedapplication/resource_arm_managed_application_definition.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/managedapplication/resource_arm_managed_application_definition.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/managedapplication/validate/managed_application_definition_test.go
Outdated
Show resolved
Hide resolved
@magodo , Thanks for your comments. I've updated code. |
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 the PR @neil-yechenwei, overall this looks good to me with just a couple comments inline. My main concern is conditionally setting things on read, typically we always read everything in.
} | ||
|
||
if (parameters.CreateUIDefinition != nil && parameters.MainTemplate == nil) || (parameters.CreateUIDefinition == nil && parameters.MainTemplate != nil) { | ||
return fmt.Errorf("`create_ui_definition` and `main_template` should be set or not set together") |
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 saying if one is set the other must be too covers all conditions:
return fmt.Errorf("`create_ui_definition` and `main_template` should be set or not set together") | |
return fmt.Errorf("if either `create_ui_definition` or `main_template` is set the other one must be too") |
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.
could we add a note about this in the docs?
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.
updated
if v, ok := d.GetOk("create_ui_definition"); ok { | ||
d.Set("create_ui_definition", v.(string)) | ||
} | ||
if v, ok := d.GetOk("main_template"); ok { | ||
d.Set("main_template", v.(string)) | ||
} | ||
if v, ok := d.GetOk("package_file_uri"); ok { | ||
d.Set("package_file_uri", v.(string)) | ||
} |
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.
why are we conditionally setting these? typically we always read in all propertie
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've debugged code. I found create_ui_definition
, main_template
and package_file_uri
returned nil
from service side. So I have to do this.
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.
lets add a comment in here stating that
} | ||
|
||
resource "azurerm_resource_group" "test" { | ||
name = "acctestRG-managedapplication-%d" |
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.
lets go with mapp here, just a short reminder/identifier so we can spot services potentially not cleaning up after themselves
name = "acctestRG-managedapplication-%d" | |
name = "acctestRG-mapp-%d" |
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.
updated
website/allowed-subcategories
Outdated
@@ -33,6 +33,7 @@ Load Balancer | |||
Log Analytics | |||
Logic App | |||
Machine Learning | |||
Managed Application |
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.
should this be
Managed Application | |
Managed Applications |
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.
updated
|
||
* `lock_level` - (Required) Specifies the managed application lock level. Valid values include `CanNotDelete`, `None`, `ReadOnly`. Changing this forces a new resource to be created. | ||
|
||
* `create_ui_definition` - (Optional) Specifies the createUiDefinition json for the backing template with Microsoft.Solutions/applications resource. |
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.
* `create_ui_definition` - (Optional) Specifies the createUiDefinition json for the backing template with Microsoft.Solutions/applications resource. | |
* `create_ui_definition` - (Optional) Specifies the `createUiDefinition` json for the backing template with `Microsoft.Solutions/applications` resource. |
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.
updated
|
||
* `location` - (Required) Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created. | ||
|
||
* `authorization` - (Required) One or more `authorization` block defined below. |
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.
might be nice to explain what the authorization blocks correspond to. I question if authorization
is the right name for the property
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.
|
||
* `description` - (Optional) Specifies the managed application definition description. | ||
|
||
* `package_enabled` - (Optional) Is enabled for this package? Defaults to `true`. |
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 this needs rewording
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.
updated
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.
Hey @neil-yechenwei, thanks for the PR. I've left only a couple comments inline, and i hope you don't mind but i am going to push the required changes soi can mege this. As well as some naming convention changes we are starting to roll out (resource/datasource at the end of the file name, dropping Arm from function names)
azurerm/internal/services/managedapplication/resource_arm_managed_application_definition.go
Outdated
Show resolved
Hide resolved
|
||
"location": azure.SchemaLocation(), | ||
|
||
"lock_level": { |
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.
could we arrange these required properties alphabetically
if v, ok := d.GetOk("create_ui_definition"); ok { | ||
d.Set("create_ui_definition", v.(string)) | ||
} | ||
if v, ok := d.GetOk("main_template"); ok { | ||
d.Set("main_template", v.(string)) | ||
} | ||
if v, ok := d.GetOk("package_file_uri"); ok { | ||
d.Set("package_file_uri", v.(string)) | ||
} |
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.
lets add a comment in here stating that
This has been released in version 2.4.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example: provider "azurerm" {
version = "~> 2.4.0"
}
# ... other configuration ... |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks! |
This PR is the implement of the issue #5294