-
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: azurerm_video_indexer_account
#27632
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 @mbfrahry! Could you take a look at the comments I left in-line?
@@ -4113,7 +4113,7 @@ resource "azurerm_key_vault" "test" { | |||
|
|||
secret_permissions = [ | |||
"Get", | |||
"List", | |||
"List", l |
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.
Accident? :o
} | ||
|
||
type StorageModel struct { | ||
StorageAccountId string `tfschema:"storage_account_id"` |
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 just be named account_id
since it's already under a storage
block?
if response.WasNotFound(account.HttpResponse) { | ||
return metadata.MarkAsGone(id) | ||
} | ||
return fmt.Errorf("reading %s: %+v", id, err) |
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.
return fmt.Errorf("reading %s: %+v", id, err) | |
return fmt.Errorf("retrieving %s: %+v", id, err) |
id, err := accounts.ParseAccountID(metadata.ResourceData.Id()) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
client := metadata.Client.VideoIndexer.AccountClient | ||
metadata.Logger.Infof("deleting %s", id) | ||
|
||
if _, err := client.Delete(ctx, *id); err != nil { | ||
return fmt.Errorf("deleting %s: %v", id, err) | ||
} |
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.
Really minor, but the ordering of this looks strange to me. Don't we usually define the client first then begin parsing IDs?
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.
Good shout! That does look weird
StorageAccountId: pointer.From(input.ResourceId), | ||
UserAssignedIdentityId: pointer.From(input.UserAssignedIdentity), |
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.
We should parse the resource IDs that are returned by the API before setting them into state so that we can catch any casing inconsistencies
if response.WasNotFound(resp.HttpResponse) { | ||
return utils.Bool(false), nil | ||
} | ||
return nil, fmt.Errorf("retreiving %s: %v", id, err) | ||
} | ||
if response.WasNotFound(resp.HttpResponse) { | ||
return utils.Bool(false), nil | ||
} | ||
return utils.Bool(true), nil |
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'm not sure why we might need to specifically check for a 404
status, any error that we get from the API when running the tests and checking that it exists is logically a false, so I think this can be simplified. Let me know if that makes sense or if I've not considered something.
if response.WasNotFound(resp.HttpResponse) { | |
return utils.Bool(false), nil | |
} | |
return nil, fmt.Errorf("retreiving %s: %v", id, err) | |
} | |
if response.WasNotFound(resp.HttpResponse) { | |
return utils.Bool(false), nil | |
} | |
return utils.Bool(true), nil | |
return nil, fmt.Errorf("retrieving %s: %v", id, err) | |
} | |
return pointer.To(true), nil |
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.
Nah, you're right. Copy pasta strikes again
|
||
data.ResourceTest(t, r, []acceptance.TestStep{ | ||
{ | ||
Config: r.basic(data), |
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 using
Config: r.basic(data), | |
Config: r.userAssignedIdentity(data), |
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.
Ooo yep yep. Ty ty
0671be2
to
5ee3c51
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 @mbfrahry LGTM 👍
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. |
Community Note
Description
This PR adds
azurerm_video_indexer_account
as a new resource.PR Checklist
For example: “
resource_name_here
- description of change e.g. adding propertynew_property_name_here
”Changes to existing Resource / Data Source
Testing
Change Log
Below please provide what should go into the changelog (if anything) conforming to the Changelog Format documented here.
azurerm_video_indexer_account
[GH-00000]This is a (please select all that apply):
Related Issue(s)
Fixes #0000
Note
If this PR changes meaningfully during the course of review please update the title and description as required.