Skip to content
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_api_management_api: split create and update method #28271

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
parse id from state in update method
wuxu92 committed Dec 18, 2024
commit fbd6705fd0936e6a17a31c66ae8d4d19eb45085a
Original file line number Diff line number Diff line change
@@ -497,13 +497,10 @@ func resourceApiManagementApiCreate(d *pluginsdk.ResourceData, meta interface{})

func resourceApiManagementApiUpdate(d *pluginsdk.ResourceData, meta interface{}) error {
client := meta.(*clients.Client).ApiManagement.ApiClient
subscriptionId := meta.(*clients.Client).Account.SubscriptionId
ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d)
defer cancel()

revision := d.Get("revision").(string)
path := d.Get("path").(string)
apiId := fmt.Sprintf("%s;rev=%s", d.Get("name").(string), revision)
version := d.Get("version").(string)
versionSetId := d.Get("version_set_id").(string)
displayName := d.Get("display_name").(string)
@@ -520,8 +517,12 @@ func resourceApiManagementApiUpdate(d *pluginsdk.ResourceData, meta interface{})
return errors.New("`display_name`, `protocols` are required when `source_api_id` is not set")
}

id := api.NewApiID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), apiId)
idPtr, err := api.ParseApiID(d.Id())
if err != nil {
return err
}

id := *idPtr
apiType := api.ApiTypeHTTP
if v, ok := d.GetOk("api_type"); ok {
apiType = api.ApiType(v.(string))
Loading