* backend/azure: Remove legacy helper/schema dependency
This now uses the backendbase package's "SDK-like" helpers instead, which
provide a much smaller subset of the former legacy SDK functionality but
enough for what this backend needs.
* remove unused replace directive
* Fix go.mod file after rebase
* Fix schema errors after self-review of code
* Change `metadata_host` to be an optional field in the schema, to match the current behavior of code
---------
Co-authored-by: Martin Atkins <mart@degeneration.co.uk>
Co-authored-by: James Bardin <j.bardin@gmail.com>
Description:"The Cloud Environment which should be used. Possible values are public, usgovernment, and china. Defaults to public. Not used and should not be specified when `metadata_host` is specified.",
DefaultFunc:schema.MultiEnvDefaultFunc([]string{"ARM_METADATA_HOSTNAME","ARM_METADATA_HOST"},""),// TODO: remove support for `METADATA_HOST` in a future version
Description:"The Hostname which should be used for the Azure Metadata Service.",
},
"access_key":{
Type:schema.TypeString,
Optional:true,
Description:"The access key to use when authenticating using a Storage Access Key.",
Description:"Base64 encoded PKCS#12 certificate bundle to use when authenticating as a Service Principal using a Client Certificate",
return&Backend{
Base:backendbase.Base{
Schema:&configschema.Block{
Attributes:map[string]*configschema.Attribute{
"subscription_id":{
Type:cty.String,
Optional:true,
Description:"The Subscription ID where the Storage Account is located.",
},
"resource_group_name":{
Type:cty.String,
Optional:true,
Description:"The Resource Group where the Storage Account is located.",
},
"storage_account_name":{
Type:cty.String,
Required:true,
Description:"The name of the storage account.",
},
"container_name":{
Type:cty.String,
Required:true,
Description:"The container name to use in the Storage Account.",
},
"key":{
Type:cty.String,
Required:true,
Description:"The blob key to use in the Storage Container.",
},
"lookup_blob_endpoint":{
Type:cty.Bool,
Optional:true,
Description:"Whether to look up the storage account blob endpoint. This is necessary when the storage account uses the Azure DNS zone endpoint.",
},
"snapshot":{
Type:cty.Bool,
Optional:true,
Description:"Whether to enable automatic blob snapshotting.",
},
"environment":{
Type:cty.String,
Optional:true,
Description:"The Cloud Environment which should be used. Possible values are public, usgovernment, and china. Defaults to public. Not used and should not be specified when `metadata_host` is specified.",
},
"metadata_host":{
Type:cty.String,
Optional:true,
Description:"The Hostname which should be used for the Azure Metadata Service.",
},
"access_key":{
Type:cty.String,
Optional:true,
Description:"The access key to use when authenticating using a Storage Access Key.",
},
"sas_token":{
Type:cty.String,
Optional:true,
Description:"The SAS Token to use when authenticating using a SAS Token.",
},
"tenant_id":{
Type:cty.String,
Optional:true,
Description:"The Tenant ID to use when authenticating using Azure Active Directory.",
},
"client_id":{
Type:cty.String,
Optional:true,
Description:"The Client ID to use when authenticating using Azure Active Directory.",
},
"client_id_file_path":{
Type:cty.String,
Optional:true,
Description:"The path to a file containing the Client ID which should be used.",
},
"endpoint":{
Type:cty.String,
Optional:true,
Deprecated:true,
Description:"`endpoint` is deprecated in favor of `msi_endpoint`, it will be removed in a future version of Terraform",
},
// Client Certificate specific fields
"client_certificate":{
Type:cty.String,
Optional:true,
Description:"Base64 encoded PKCS#12 certificate bundle to use when authenticating as a Service Principal using a Client Certificate",
},
"client_certificate_path":{
Type:cty.String,
Optional:true,
Description:"The path to the Client Certificate associated with the Service Principal for use when authenticating as a Service Principal using a Client Certificate.",
},
"client_certificate_password":{
Type:cty.String,
Optional:true,
Description:"The password associated with the Client Certificate. For use when authenticating as a Service Principal using a Client Certificate",
},
// Client Secret specific fields
"client_secret":{
Type:cty.String,
Optional:true,
Description:"The Client Secret which should be used. For use When authenticating as a Service Principal using a Client Secret.",
},
"client_secret_file_path":{
Type:cty.String,
Optional:true,
Description:"The path to a file containing the Client Secret which should be used. For use When authenticating as a Service Principal using a Client Secret.",
},
// OIDC specific fields
"use_oidc":{
Type:cty.Bool,
Optional:true,
Description:"Allow OpenID Connect to be used for authentication",
},
"ado_pipeline_service_connection_id":{
Type:cty.String,
Optional:true,
Description:"The Azure DevOps Pipeline Service Connection ID.",
},
"oidc_request_token":{
Type:cty.String,
Optional:true,
Description:"The bearer token for the request to the OIDC provider. For use when authenticating as a Service Principal using OpenID Connect.",
},
"oidc_request_url":{
Type:cty.String,
Optional:true,
Description:"The URL for the OIDC provider from which to request an ID token. For use when authenticating as a Service Principal using OpenID Connect.",
},
"oidc_token":{
Type:cty.String,
Optional:true,
Description:"The OIDC ID token for use when authenticating as a Service Principal using OpenID Connect.",
},
"oidc_token_file_path":{
Type:cty.String,
Optional:true,
Description:"The path to a file containing an OIDC ID token for use when authenticating as a Service Principal using OpenID Connect.",
},
// Managed Identity specific fields
"use_msi":{
Type:cty.Bool,
Optional:true,
Description:"Allow Managed Identity to be used for Authentication.",
},
"msi_endpoint":{
Type:cty.String,
Optional:true,
Description:"The path to a custom endpoint for Managed Identity - in most circumstances this should be detected automatically.",
},
// Azure CLI specific fields
"use_cli":{
Type:cty.Bool,
Optional:true,
Description:"Allow Azure CLI to be used for Authentication.",
},
// Azure AKS Workload Identity fields
"use_aks_workload_identity":{
Type:cty.Bool,
Optional:true,
Description:"Allow Azure AKS Workload Identity to be used for Authentication.",
},
// Feature Flags
"use_azuread_auth":{
Type:cty.Bool,
Optional:true,
Description:"Whether to use Azure Active Directory authentication to access the Storage Data Plane APIs.",
},
},
},
"client_certificate_path":{
Type:schema.TypeString,
Optional:true,
Description:"The path to the Client Certificate associated with the Service Principal for use when authenticating as a Service Principal using a Client Certificate.",
Description:"The path to a file containing the Client Secret which should be used. For use When authenticating as a Service Principal using a Client Secret.",
Description:"The URL for the OIDC provider from which to request an ID token. For use when authenticating as a Service Principal using OpenID Connect.",
returnnil,fmt.Errorf("mismatch between supplied Client ID and that provided by AKS Workload Identity - please remove, ensure they match, or disable use_aks_workload_identity")
returnnil,fmt.Errorf("mismatch between supplied Tenant ID and that provided by AKS Workload Identity - please remove, ensure they match, or disable use_aks_workload_identity")