-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
provider/azurerm: Container Registry #10973
provider/azurerm: Container Registry #10973
Conversation
Tests pass
|
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.
ResourceName: resourceName, | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
ImportStateVerifyIgnore: []string{"storage_account"}, |
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 do we ignore the storage_account
?
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.
This is because the inner access_key
field isn't returned through the API after the initial CreateOrUpdate. Potentially we could retrieve it via the Storage Account - but it felt like the wrong thing to do (given it's a completely unrelated object)?
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.
ok, that makes sense
Tags: expandTags(tags), | ||
} | ||
|
||
if v, ok := d.GetOk("storage_account"); ok { |
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.
If this is a required field, we don't need the if v, ok
part - we can assume it's always there
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.
done
storageAccountName := account["name"].(string) | ||
storageAccountAccessKey := account["access_key"].(string) | ||
parameters.RegistryProperties.StorageAccount = &containerregistry.StorageAccountProperties{ | ||
Name: &storageAccountName, |
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 should be wrapped in azure.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.
done
} | ||
} | ||
|
||
_, err := client.CreateOrUpdate(resourceGroup, name, 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.
Does this handle the polling or do we need to do that in our code using a staterefreshfunc?
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.
So, the SDK says that it's only possible to get a 200 OK
back (i.e. that it's not a long running operation) - which I've confirmed in all of the testing I've done with this, where the Registry's created so quickly I've not seen it block.
The Documentation on the other hand specifies that it's possible to get a 202 Accepted
back - however I've noticed a couple of issues in the Documentation anyway so this may well be a bug in the docs.
Given they're both generated from the same place I'll file an issue - but as yet I've not seen a 202
in real world usage.
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.
Opened an issue: Azure/azure-rest-api-specs#842
Updated and re-ran the tests:
|
This LGTM! thanks for the changes :)
|
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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Fixes #10819
The
access_key
for the Storage Account isn't returned from the server once the Container Registry has been created (for obvious reasons) - so I've ignored that object in the import tests for now.