-
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
Support for EncryptionAtHost Feature Registration #17185
Comments
hey @paul-hugill Thanks for opening this issue. Taking a look through here, whilst the Azure Provider does register Resource Providers by default, we intentionally don't register any features as these are purely for Preview functionality. In this case it's rather odd that this is still a Feature when it's not documented as in Preview, however since this page references that you must use a specific Portal link to access the Encryption functionality I believe this may still be in some kind of Preview phase here? With regards to having a feature-flag for Terraform to register specific features, since this is intended to be used for Preview features we intentionally don't do this and instead call these out in the documentation (to use the Azure CLI to do so, although the Resource Provider Registration resource should also work) - however I think the main question here is why this Feature is required to be turned on when this isn't in Preview, which (given the Portal reference above) leads me to think that this must still be in (some kind of) Preview? We'd need the Service Team to confirm the status of the resource here, @mybayern1974 would you be able to reach out to the Service Team to confirm why this is a Feature here? Thanks! |
Thanks @tombuildsstuff for the quick response, I had thought the features were mainly just for Preview stuff too but I couldn't find anything about it still being preview and it is in the Public Portal now without using the link, so it seems a bit weird. I can open an support case with MS as well if that would help try and get some clarity. |
@paul-hugill I've checked with service team. The feature is in GA, and they will be removing this prerequisite of registering the feature flag at some point of time. |
Thanks @myc2h6o, did they give a rough timeframe? Are we talking days, weeks, months? |
@paul-hugill I haven't got a rough timeframe yet from service team, will update the issue once I have that |
Hi @paul-hugill just got an update from service team, the current plan is to remove the prerequisite at Q3 2022. We could expect it to be removed before the end of Sept. 2022. |
Thanks @myc2h6o that sounds good, I'll keep an eye out for it and try later in Q3. |
I am facing the same issue here with this requirement. Relating to the feature enablement, is there a bug somewhere where we try to register a feature in an existing namespace which is already enabled (whether that is preview or not) but because the existing namespace is already registered, its asking us to import that feature registration in the state? My belief is the following code should just register the
I realise there may be a limitation with the call that is made to Azure here, I guess the TLDR is that we should be able to enable features in an existing namespace that is already enabled without having to import the registration status of that existing namespace into the state. |
As of 2022-09-05 the feature flag requirement is still present. Will try again in October. |
I am stuck on the same issue as well. Unable to register the feature when a parent namespace provider is already registered. This is not an issue when you use the az cli or the REST API. After snooping through the logs, I noticed that the code flow is currently as follows
However there is never a call made to ensure that the feature in question is ever registered. It simply errors out upon provider namespace registration check. The correct implementation should be a call to the feature registration API upon checking if the feature is registered and not on the parent namespace check. On a side note: The API used to register the feature for the one's that succeeds is not the one documented in the official documentation. Currently the API used is Steps to reproduce: provider "azurerm" {
subscription_id = <subscription id here>
features {}
skip_provider_registration = true
}
resource "azurerm_resource_provider_registration" "example" {
name = "Microsoft.Network"
feature {
name = "AllowGlobalTagsForStorage"
registered = true
}
} |
Same issue. Also the new "featureProviders" api says registered and the "features" api stays registering for 10-15 minutes. PS1 Get-AzProviderFeature command also use "features" api. Used the azapi provider to workaround:
|
Hi @myc2h6o , just wanted to check/confirm that this is still an issue (Sep/2023) since the encryption_at_host_enabled feature still requires manual activation. Would that be correct?
|
Hi tombuildsstuff, Is there any solution for this kind of scenario? I'm affected too, when trying to enable a Preview Feature for enabling EncryptionAtHost for AKS service with the following config: provider "azurerm" { resource "azurerm_resource_provider_registration" "EnableEncryptionAtHostPreview" { If we let terraform to handle the providers registration, as recommended, (not setting the skip_provider_registration variable)... we get the error that says: │ The Resource Provider "Microsoft.ContainerService" is automatically If we enable the skip_provider_registration (as per documentation), then we get the error: A resource with the ID All right, we might solve that error importing that provider before executing plan phase... BUT when setting that variable to true, then we would require to enable any other provider we might require during coding, even those that would be automatically registered by Terraform, right? (and who knows the providers we might need...), AND, what's even worst, we would also need to import any other provider already registered previous plan execution (not sure but I think some providers are registered by default when provisioning a subscription)... just to enable any desired preview feature that is under it's scope, right?... Hopefully you will agree that all of this makes things even more difficult rather than easier. I think you, AzureRM provider Team, should look into this carefully and offer a proper solution and not what is documented here: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_provider_registration In the meantime, I will try to find a WA other than the null_resource and the local-exec... that solution is not for me..., having to do the az login on the command, I don't like it ... storing the credential secret somewhere as plain text... I might try the WA of sending requests directly to the azapi ... I will be looking forward to hearing from you :). Many thanks for all your work and efforts. All the best, |
Hi, In case it can help someone that reaches this issue :) Well, this is my WA, finally there's no need to pass to the script any secret, it will catch it from the environment variables
The script content:
Regards, |
I think this is resolved now? I can use https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_provider_registration to register |
I've just arrived at this thread because I still have the issue trying to enable encryption_at_host_enabled on a VM. I've tried to register the provider in Terraform but I get stuck in the same loop as @evmimagina |
Hi all. Here's another workaround, this time using AZ CLI...
|
Is this still required? At least I do not find the option to register this any longer in the features section in the portal. |
Still required. It's a preview feature so it's not so easy to find in the portal. In fact I don't know how to look for it in the portal myself but I can confirm that as of 2 weeks ago it was still required in order to create clusters with node encryption. We registered it in Azure CLI to get Terraform working. |
How did you do this exactly? I have:
Which throws the error:
How did you get around this? |
Ok to be completely clear:
Does not work. I get in Terraform Cloud:
After which when trying to import it, I get another error:
So this is CLEARLY not set up properly in azurerm at all. It merely checks if the namespace is registered and if it is already, it fails. It doesn't actually check if EncryptionAtHost is ever enabled or not. It's definitely not working as intended at all. I suppose I could add to my providers.tf: But not only should this not be even required, I don't want to for the reasons this person @evmimagina: #17185 (comment) mentioned. As it will break other things in my setup. I also tried In the meantime I will simply use this:
|
So does that mean we should raise a new issue about this code not working:
i.e. that we can't register missing sub-dependencies |
I found a workaround to mitigate the However, I don't know, if this is working on fresh subscriptions where import {
id = "/subscriptions/${data.azurerm_client_config.this.subscription_id}/providers/Microsoft.Compute"
to = azurerm_resource_provider_registration.encryption_at_host
}
resource "azurerm_resource_provider_registration" "encryption_at_host" {
name = "Microsoft.Compute"
feature {
name = "EncryptionAtHost"
registered = true
}
} |
Is there an existing issue for this?
Community Note
Description
To use the
encryption_at_host_enabled
on virtual machine resources you need to enable theEncryptionAtHost
feature in theMicrosoft.Compute
Provider Namespace.The automatic provider registration does not appear to register this feature, though it looks like the support on the resources has been there for a while. I have tested with both provider version
3.6.0
and3.9.0
but also not found any references to people using it and setting that feature up, so I am not sure if I am just doing something wrong.Only current workaround I could find (other than doing manually) would be to turn off the automatic provider registration and having to register every provider individually, which is not going to be ideal.
Without doing that I get this error, which is expected behaviour whilst automatic registration is enabled:
If this doesn't want to be added as a default on the automatic registration, then maybe as a provider feature flag?
Apologies if I have just missed something obvious.
New or Affected Resource(s)/Data Source(s)
provider
Potential Terraform Configuration
References
https://docs.microsoft.com/en-us/azure/virtual-machines/linux/disks-enable-host-based-encryption-cli#prerequisites
The text was updated successfully, but these errors were encountered: