This commit is contained in:
ms-henglu 2021-11-17 12:15:12 +08:00 коммит произвёл GitHub
Родитель 78aaf3c49d
Коммит d20df826d6
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
42 изменённых файлов: 233 добавлений и 234 удалений

Просмотреть файл

@ -4,8 +4,8 @@ FEATURES:
ENHANCEMENTS:
* `azurermg_resource` - enhanced body validation.
* `azurermg` - supports default location and tags.
* `azurerm-restapi_resource` - enhanced body validation.
* `azurerm-restapi` - supports default location and tags.
BUG FIXES:
@ -13,8 +13,8 @@ BUG FIXES:
FEATURES:
* **New Data Source:** `azurermg_resource`
* **New Resource:** `azurermg_resource`
* **New Data Source:** `azurerm-restapi_resource`
* **New Resource:** `azurerm-restapi_resource`
ENHANCEMENTS:

Просмотреть файл

@ -1,34 +1,34 @@
# Generic Terraform Provider for Azure (Resource Manager)
# Terraform Provider for Azure Resource Manager Rest API
## How to use?
This project is used in API test only.
This provider hasn't been formly released, it can only be used by configuring provider override.
```
1. git clone https://github.com/ms-henglu/terraform-provider-azurerm-generic.git
2. cd terraform-provider-azurerm-generic
1. git clone https://github.com/Azure/terraform-provider-azurerm-restapi.git
2. cd terraform-provider-azurerm-restapi
3. go install
4. edit terraform.rc and add the following configuration, refs: https://www.terraform.io/docs/cli/config/config-file.html
dev_overrides {
"ms-henglu/azurermg" = "C:\Users\henglu\go\bin" #path to provider execute
"Azure/azurerm-restapi" = "C:\\Users\\henglu\\go\\bin" #path to provider execute
}
```
## Usage Example
The following example shows how to use `azurermg_resource` to manage machine learning compute resource.
The following example shows how to use `azurerm-restapi_resource` to manage machine learning compute resource.
```hcl
terraform {
required_providers {
azurermg = {
source = "ms-henglu/azurermg"
azurerm-restapi = {
source = "Azure/azurerm-restapi"
}
}
}
provider "azurermg" {
provider "azurerm-restapi" {
# More information on the authentication methods supported by
# the AzureRM Provider can be found here:
# https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
@ -48,7 +48,7 @@ data "azurerm_machine_learning_workspace" "existing" {
resource_group_name = "example-resources"
}
resource "azurermg_resource" "example" {
resource "azurerm-restapi_resource" "example" {
resource_id = "${data.azurerm_machine_learning_workspace.existing.id}/computes/example"
type = "Microsoft.MachineLearningServices/workspaces/computes@2021-07-01"
body = <<BODY

Просмотреть файл

@ -1,7 +1,7 @@
terraform {
required_providers {
azurermg = {
source = "ms-henglu/azurermg"
azurerm-restapi = {
source = "Azure/azurerm-restapi"
}
}
}
@ -10,7 +10,7 @@ provider "azurerm" {
features {}
}
provider "azurermg" {
provider "azurerm-restapi" {
schema_validation_enabled = false
}
@ -27,7 +27,7 @@ resource "azurerm_container_registry" "acr" {
admin_enabled = false
}
resource "azurermg_patch_resource" "test" {
resource "azurerm-restapi_patch_resource" "test" {
resource_id = azurerm_container_registry.acr.id
type = "Microsoft.ContainerRegistry/registries@2020-11-01-preview"
body = <<BODY

Просмотреть файл

@ -1,7 +1,7 @@
terraform {
required_providers {
azurermg = {
source = "ms-henglu/azurermg"
azurerm-restapi = {
source = "Azure/azurerm-restapi"
}
}
}
@ -10,7 +10,7 @@ provider "azurerm" {
features {}
}
provider "azurermg" {
provider "azurerm-restapi" {
}
data "azurerm_client_config" "test" {}
@ -57,7 +57,7 @@ resource "azurerm_machine_learning_workspace" "test" {
}
resource "azurermg_resource" "test" {
resource "azurerm-restapi_resource" "test" {
resource_id = "${azurerm_machine_learning_workspace.test.id}/computes/acctest6032"
type = "Microsoft.MachineLearningServices/workspaces/computes@2021-07-01"
body = <<BODY

Просмотреть файл

@ -1,7 +1,7 @@
terraform {
required_providers {
azurermg = {
source = "ms-henglu/azurermg"
azurerm-restapi = {
source = "Azure/azurerm-restapi"
}
}
}
@ -10,7 +10,7 @@ provider "azurerm" {
features {}
}
provider "azurermg" {
provider "azurerm-restapi" {
}
resource "azurerm_resource_group" "test" {
@ -49,7 +49,7 @@ resource "azurerm_synapse_sql_pool" "test" {
}
resource "azurermg_resource" "test" {
resource "azurerm-restapi_resource" "test" {
resource_id = "${azurerm_synapse_sql_pool.test.id}/workloadGroups/smallrc"
type = "Microsoft.Synapse/workspaces/sqlPools/workloadGroups@2020-12-01"
body = <<BODY

2
go.mod
Просмотреть файл

@ -1,4 +1,4 @@
module github.com/ms-henglu/terraform-provider-azurermg
module github.com/Azure/terraform-provider-azurerm-restapi
require (
github.com/Azure/azure-sdk-for-go v57.0.0+incompatible // indirect

Просмотреть файл

@ -5,9 +5,8 @@ import (
"fmt"
"regexp"
"github.com/ms-henglu/terraform-provider-azurermg/internal/acceptance"
"github.com/ms-henglu/terraform-provider-azurermg/internal/clients"
"github.com/Azure/terraform-provider-azurerm-restapi/internal/acceptance"
"github.com/Azure/terraform-provider-azurerm-restapi/internal/clients"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
)

Просмотреть файл

@ -5,12 +5,12 @@ import (
"os"
"testing"
"github.com/Azure/terraform-provider-azurerm-restapi/internal/clients"
"github.com/Azure/terraform-provider-azurerm-restapi/internal/provider"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
"github.com/ms-henglu/terraform-provider-azurermg/internal/clients"
"github.com/ms-henglu/terraform-provider-azurermg/internal/provider"
)
const (
@ -105,7 +105,7 @@ func (td TestData) runAcceptanceTest(t *testing.T, testCase resource.TestCase) {
func (td TestData) providers() map[string]func() (*schema.Provider, error) {
return map[string]func() (*schema.Provider, error){
"azurermg": func() (*schema.Provider, error) { //nolint:unparam
"azurerm-restapi": func() (*schema.Provider, error) { //nolint:unparam
azurerm := provider.AzureProvider()
return azurerm, nil
},

Просмотреть файл

@ -6,9 +6,9 @@ import (
"os"
"sync"
"github.com/Azure/terraform-provider-azurerm-restapi/internal/clients"
"github.com/Azure/terraform-provider-azurerm-restapi/internal/features"
"github.com/hashicorp/go-azure-helpers/authentication"
"github.com/ms-henglu/terraform-provider-azurermg/internal/clients"
"github.com/ms-henglu/terraform-provider-azurermg/internal/features"
)
var (

Просмотреть файл

@ -3,8 +3,8 @@ package acceptance
import (
"context"
"github.com/Azure/terraform-provider-azurerm-restapi/internal/clients"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
"github.com/ms-henglu/terraform-provider-azurermg/internal/clients"
)
type TestResource interface {

Просмотреть файл

@ -4,10 +4,10 @@ import (
"fmt"
"strings"
"github.com/Azure/terraform-provider-azurerm-restapi/internal/services/parse"
"github.com/Azure/terraform-provider-azurerm-restapi/internal/services/validate"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
"github.com/ms-henglu/terraform-provider-azurermg/internal/services/parse"
"github.com/ms-henglu/terraform-provider-azurermg/internal/services/validate"
)
type IdentityType string

Просмотреть файл

@ -5,7 +5,7 @@ import (
"fmt"
"strings"
"github.com/ms-henglu/terraform-provider-azurermg/internal/azure/types"
"github.com/Azure/terraform-provider-azurerm-restapi/internal/azure/types"
)
type Schema struct {

Просмотреть файл

@ -7,7 +7,7 @@ import (
"log"
"sort"
"github.com/ms-henglu/terraform-provider-azurermg/internal/azure/types"
"github.com/Azure/terraform-provider-azurerm-restapi/internal/azure/types"
)
var schema *Schema

Просмотреть файл

@ -3,7 +3,7 @@ package azure_test
import (
"testing"
"github.com/ms-henglu/terraform-provider-azurermg/internal/azure"
"github.com/Azure/terraform-provider-azurerm-restapi/internal/azure"
)
func Test_GetAzureSchema(t *testing.T) {

Просмотреть файл

@ -5,7 +5,7 @@ import (
"fmt"
"strconv"
"github.com/ms-henglu/terraform-provider-azurermg/utils"
"github.com/Azure/terraform-provider-azurerm-restapi/utils"
)
var _ TypeBase = &ArrayType{}

Просмотреть файл

@ -3,7 +3,7 @@ package types
import (
"fmt"
"github.com/ms-henglu/terraform-provider-azurermg/utils"
"github.com/Azure/terraform-provider-azurerm-restapi/utils"
)
type BuiltInTypeKind int

Просмотреть файл

@ -4,7 +4,7 @@ import (
"encoding/json"
"fmt"
"github.com/ms-henglu/terraform-provider-azurermg/utils"
"github.com/Azure/terraform-provider-azurerm-restapi/utils"
)
var _ TypeBase = &DiscriminatedObjectType{}

Просмотреть файл

@ -4,7 +4,7 @@ import (
"encoding/json"
"fmt"
"github.com/ms-henglu/terraform-provider-azurermg/utils"
"github.com/Azure/terraform-provider-azurerm-restapi/utils"
)
var _ TypeBase = &ObjectType{}

Просмотреть файл

@ -3,7 +3,7 @@ package types
import (
"fmt"
"github.com/ms-henglu/terraform-provider-azurermg/utils"
"github.com/Azure/terraform-provider-azurerm-restapi/utils"
)
var _ TypeBase = &StringLiteralType{}

Просмотреть файл

@ -3,7 +3,7 @@ package types
import (
"encoding/json"
"github.com/ms-henglu/terraform-provider-azurermg/utils"
"github.com/Azure/terraform-provider-azurerm-restapi/utils"
)
var _ TypeBase = &UnionType{}

Просмотреть файл

@ -6,8 +6,8 @@ import (
"reflect"
"testing"
"github.com/ms-henglu/terraform-provider-azurermg/internal/azure"
"github.com/ms-henglu/terraform-provider-azurermg/utils"
"github.com/Azure/terraform-provider-azurerm-restapi/internal/azure"
"github.com/Azure/terraform-provider-azurerm-restapi/utils"
)
func Test_BodyValidation(t *testing.T) {
@ -177,12 +177,12 @@ func Test_WriteOnly(t *testing.T) {
Output string
}{
{
Id: "/subscriptions/67a9759d-d099-4aa8-8675-e6cfd669c3f4/resourceGroups/henglu-rg1111/providers/Microsoft.Network/loadBalancers/henglulb",
Id: "/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/rg/providers/Microsoft.Network/loadBalancers/mylb",
ApiVersion: "2021-03-01",
Input: `
{
"name": "henglulb",
"id": "/subscriptions/67a9759d-d099-4aa8-8675-e6cfd669c3f4/resourceGroups/henglu-rg1111/providers/Microsoft.Network/loadBalancers/henglulb",
"name": "mylb",
"id": "/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/rg/providers/Microsoft.Network/loadBalancers/mylb",
"etag": "W/\"4cdb755a-4607-49eb-b52c-2f5d06a9a0d5\"",
"type": "Microsoft.Network/loadBalancers",
"location": "westus",
@ -193,18 +193,18 @@ func Test_WriteOnly(t *testing.T) {
"frontendIPConfigurations": [
{
"name": "PublicIPAddress",
"id": "/subscriptions/67a9759d-d099-4aa8-8675-e6cfd669c3f4/resourceGroups/henglu-rg1111/providers/Microsoft.Network/loadBalancers/henglulb/frontendIPConfigurations/PublicIPAddress",
"id": "/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/rg/providers/Microsoft.Network/loadBalancers/mylb/frontendIPConfigurations/PublicIPAddress",
"etag": "W/\"4cdb755a-4607-49eb-b52c-2f5d06a9a0d5\"",
"type": "Microsoft.Network/loadBalancers/frontendIPConfigurations",
"properties": {
"provisioningState": "Succeeded",
"privateIPAllocationMethod": "Dynamic",
"publicIPAddress": {
"id": "/subscriptions/67a9759d-d099-4aa8-8675-e6cfd669c3f4/resourceGroups/henglu-rg1111/providers/Microsoft.Network/publicIPAddresses/hengluIp"
"id": "/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/rg/providers/Microsoft.Network/publicIPAddresses/myip"
},
"inboundNatRules": [
{
"id": "/subscriptions/67a9759d-d099-4aa8-8675-e6cfd669c3f4/resourceGroups/henglu-rg1111/providers/Microsoft.Network/loadBalancers/henglulb/inboundNatRules/RDPAccess"
"id": "/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/rg/providers/Microsoft.Network/loadBalancers/mylb/inboundNatRules/RDPAccess"
}
]
}
@ -216,13 +216,13 @@ func Test_WriteOnly(t *testing.T) {
"inboundNatRules": [
{
"name": "RDPAccess",
"id": "/subscriptions/67a9759d-d099-4aa8-8675-e6cfd669c3f4/resourceGroups/henglu-rg1111/providers/Microsoft.Network/loadBalancers/henglulb/inboundNatRules/RDPAccess",
"id": "/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/rg/providers/Microsoft.Network/loadBalancers/mylb/inboundNatRules/RDPAccess",
"etag": "W/\"4cdb755a-4607-49eb-b52c-2f5d06a9a0d5\"",
"type": "Microsoft.Network/loadBalancers/inboundNatRules",
"properties": {
"provisioningState": "Succeeded",
"frontendIPConfiguration": {
"id": "/subscriptions/67a9759d-d099-4aa8-8675-e6cfd669c3f4/resourceGroups/henglu-rg1111/providers/Microsoft.Network/loadBalancers/henglulb/frontendIPConfigurations/PublicIPAddress"
"id": "/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/rg/providers/Microsoft.Network/loadBalancers/mylb/frontendIPConfigurations/PublicIPAddress"
},
"frontendPort": 3389,
"backendPort": 3389,
@ -245,18 +245,18 @@ func Test_WriteOnly(t *testing.T) {
`,
Output: `
{
"name": "henglulb",
"name": "mylb",
"location": "westus",
"tags": {},
"properties": {
"frontendIPConfigurations": [
{
"name": "PublicIPAddress",
"id": "/subscriptions/67a9759d-d099-4aa8-8675-e6cfd669c3f4/resourceGroups/henglu-rg1111/providers/Microsoft.Network/loadBalancers/henglulb/frontendIPConfigurations/PublicIPAddress",
"id": "/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/rg/providers/Microsoft.Network/loadBalancers/mylb/frontendIPConfigurations/PublicIPAddress",
"properties": {
"privateIPAllocationMethod": "Dynamic",
"publicIPAddress": {
"id": "/subscriptions/67a9759d-d099-4aa8-8675-e6cfd669c3f4/resourceGroups/henglu-rg1111/providers/Microsoft.Network/publicIPAddresses/hengluIp"
"id": "/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/rg/providers/Microsoft.Network/publicIPAddresses/myip"
}
}
}
@ -267,10 +267,10 @@ func Test_WriteOnly(t *testing.T) {
"inboundNatRules": [
{
"name": "RDPAccess",
"id": "/subscriptions/67a9759d-d099-4aa8-8675-e6cfd669c3f4/resourceGroups/henglu-rg1111/providers/Microsoft.Network/loadBalancers/henglulb/inboundNatRules/RDPAccess",
"id": "/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/rg/providers/Microsoft.Network/loadBalancers/mylb/inboundNatRules/RDPAccess",
"properties": {
"frontendIPConfiguration": {
"id": "/subscriptions/67a9759d-d099-4aa8-8675-e6cfd669c3f4/resourceGroups/henglu-rg1111/providers/Microsoft.Network/loadBalancers/henglulb/frontendIPConfigurations/PublicIPAddress"
"id": "/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/rg/providers/Microsoft.Network/loadBalancers/mylb/frontendIPConfigurations/PublicIPAddress"
},
"frontendPort": 3389,
"backendPort": 3389,
@ -295,7 +295,7 @@ func Test_WriteOnly(t *testing.T) {
ApiVersion: "2021-07-01",
Input: `
{
"id": "/subscriptions/67a9759d-d099-4aa8-8675-e6cfd669c3f4/resourceGroups/acctest5076/providers/Microsoft.MachineLearningServices/workspaces/acctest5076",
"id": "/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/acctest5076/providers/Microsoft.MachineLearningServices/workspaces/acctest5076",
"name": "acctest5076",
"type": "Microsoft.MachineLearningServices/workspaces",
"location": "westeurope",
@ -304,9 +304,9 @@ func Test_WriteOnly(t *testing.T) {
"properties": {
"friendlyName": "",
"description": "",
"storageAccount": "/subscriptions/67a9759d-d099-4aa8-8675-e6cfd669c3f4/resourcegroups/acctest5076/providers/microsoft.storage/storageaccounts/acctest5076",
"keyVault": "/subscriptions/67a9759d-d099-4aa8-8675-e6cfd669c3f4/resourcegroups/acctest5076/providers/microsoft.keyvault/vaults/acctest5076",
"applicationInsights": "/subscriptions/67a9759d-d099-4aa8-8675-e6cfd669c3f4/resourcegroups/acctest5076/providers/microsoft.insights/components/acctest5076",
"storageAccount": "/subscriptions/00000000-0000-0000-0000-00000000000/resourcegroups/acctest5076/providers/microsoft.storage/storageaccounts/acctest5076",
"keyVault": "/subscriptions/00000000-0000-0000-0000-00000000000/resourcegroups/acctest5076/providers/microsoft.keyvault/vaults/acctest5076",
"applicationInsights": "/subscriptions/00000000-0000-0000-0000-00000000000/resourcegroups/acctest5076/providers/microsoft.insights/components/acctest5076",
"hbiWorkspace": false,
"tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47",
"imageBuildCompute": "",
@ -325,7 +325,7 @@ func Test_WriteOnly(t *testing.T) {
"allowPublicAccessWhenBehindVnet": false,
"publicNetworkAccess": "Disabled",
"discoveryUrl": "https://westeurope.api.azureml.ms/discovery",
"mlFlowTrackingUri": "azureml://westeurope.api.azureml.ms/mlflow/v1.0/subscriptions/67a9759d-d099-4aa8-8675-e6cfd669c3f4/resourceGroups/acctest5076/providers/Microsoft.MachineLearningServices/workspaces/acctest5076",
"mlFlowTrackingUri": "azureml://westeurope.api.azureml.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/acctest5076/providers/Microsoft.MachineLearningServices/workspaces/acctest5076",
"sdkTelemetryAppInsightsKey": "9ac578de-874f-4fea-85bc-7e4cefd0d47f"
},
"identity": {
@ -339,10 +339,10 @@ func Test_WriteOnly(t *testing.T) {
},
"systemData": {
"createdAt": "2021-11-12T07:20:01.8875955Z",
"createdBy": "henglu@microsoft.com",
"createdBy": "someone@microsoft.com",
"createdByType": "User",
"lastModifiedAt": "2021-11-12T07:20:01.8875955Z",
"lastModifiedBy": "henglu@microsoft.com",
"lastModifiedBy": "someone@microsoft.com",
"lastModifiedByType": "User"
}
}
@ -355,9 +355,9 @@ func Test_WriteOnly(t *testing.T) {
"properties": {
"friendlyName": "",
"description": "",
"storageAccount": "/subscriptions/67a9759d-d099-4aa8-8675-e6cfd669c3f4/resourcegroups/acctest5076/providers/microsoft.storage/storageaccounts/acctest5076",
"keyVault": "/subscriptions/67a9759d-d099-4aa8-8675-e6cfd669c3f4/resourcegroups/acctest5076/providers/microsoft.keyvault/vaults/acctest5076",
"applicationInsights": "/subscriptions/67a9759d-d099-4aa8-8675-e6cfd669c3f4/resourcegroups/acctest5076/providers/microsoft.insights/components/acctest5076",
"storageAccount": "/subscriptions/00000000-0000-0000-0000-00000000000/resourcegroups/acctest5076/providers/microsoft.storage/storageaccounts/acctest5076",
"keyVault": "/subscriptions/00000000-0000-0000-0000-00000000000/resourcegroups/acctest5076/providers/microsoft.keyvault/vaults/acctest5076",
"applicationInsights": "/subscriptions/00000000-0000-0000-0000-00000000000/resourcegroups/acctest5076/providers/microsoft.insights/components/acctest5076",
"hbiWorkspace": false,
"imageBuildCompute": "",
"containerRegistry": null,

Просмотреть файл

@ -5,10 +5,10 @@ import (
"fmt"
"strings"
"github.com/Azure/terraform-provider-azurerm-restapi/internal/common"
"github.com/Azure/terraform-provider-azurerm-restapi/internal/features"
"github.com/hashicorp/go-azure-helpers/authentication"
"github.com/hashicorp/go-azure-helpers/sender"
"github.com/ms-henglu/terraform-provider-azurermg/internal/common"
"github.com/ms-henglu/terraform-provider-azurermg/internal/features"
)
type ClientBuilder struct {

Просмотреть файл

@ -5,8 +5,8 @@ import (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/validation"
"github.com/ms-henglu/terraform-provider-azurermg/internal/common"
"github.com/ms-henglu/terraform-provider-azurermg/internal/features"
"github.com/Azure/terraform-provider-azurerm-restapi/internal/common"
"github.com/Azure/terraform-provider-azurerm-restapi/internal/features"
)
type Client struct {

Просмотреть файл

@ -6,10 +6,10 @@ import (
"strings"
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/terraform-provider-azurerm-restapi/internal/features"
"github.com/Azure/terraform-provider-azurerm-restapi/version"
"github.com/hashicorp/go-azure-helpers/sender"
"github.com/hashicorp/terraform-plugin-sdk/v2/meta"
"github.com/ms-henglu/terraform-provider-azurermg/internal/features"
"github.com/ms-henglu/terraform-provider-azurermg/version"
)
type ClientOptions struct {
@ -28,13 +28,13 @@ func (o ClientOptions) ConfigureClient(c *autorest.Client, authorizer autorest.A
setUserAgent(c, o.TerraformVersion)
c.Authorizer = authorizer
c.Sender = sender.BuildSender("AzureRMG")
c.Sender = sender.BuildSender("azurerm-restapi")
}
func setUserAgent(client *autorest.Client, tfVersion string) {
tfUserAgent := fmt.Sprintf("HashiCorp Terraform/%s (+https://www.terraform.io) Terraform Plugin SDK/%s", tfVersion, meta.SDKVersionString())
providerUserAgent := fmt.Sprintf("%s terraform-provider-azurermg/%s", tfUserAgent, version.ProviderVersion)
providerUserAgent := fmt.Sprintf("%s terraform-provider-azurerm-restapi/%s", tfUserAgent, version.ProviderVersion)
client.UserAgent = strings.TrimSpace(fmt.Sprintf("%s %s", client.UserAgent, providerUserAgent))
// append the CloudShell version to the user agent if it exists

Просмотреть файл

@ -4,12 +4,12 @@ import (
"context"
"fmt"
"github.com/Azure/terraform-provider-azurerm-restapi/internal/clients"
"github.com/Azure/terraform-provider-azurerm-restapi/internal/features"
"github.com/Azure/terraform-provider-azurerm-restapi/internal/services"
"github.com/hashicorp/go-azure-helpers/authentication"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/ms-henglu/terraform-provider-azurermg/internal/clients"
"github.com/ms-henglu/terraform-provider-azurermg/internal/features"
"github.com/ms-henglu/terraform-provider-azurermg/internal/services"
)
func AzureProvider() *schema.Provider {
@ -20,10 +20,10 @@ func azureProvider() *schema.Provider {
dataSources := make(map[string]*schema.Resource)
resources := make(map[string]*schema.Resource)
resources["azurermg_resource"] = services.ResourceAzureGenericResource()
resources["azurermg_patch_resource"] = services.ResourceAzureGenericPatchResource()
resources["azurerm-restapi_resource"] = services.ResourceAzureGenericResource()
resources["azurerm-restapi_patch_resource"] = services.ResourceAzureGenericPatchResource()
dataSources["azurermg_resource"] = services.ResourceAzureGenericDataSource()
dataSources["azurerm-restapi_resource"] = services.ResourceAzureGenericDataSource()
p := &schema.Provider{
Schema: map[string]*schema.Schema{

Просмотреть файл

@ -6,15 +6,15 @@ import (
"net/http"
"time"
"github.com/Azure/terraform-provider-azurerm-restapi/internal/azure/identity"
"github.com/Azure/terraform-provider-azurerm-restapi/internal/azure/location"
"github.com/Azure/terraform-provider-azurerm-restapi/internal/azure/tags"
"github.com/Azure/terraform-provider-azurerm-restapi/internal/clients"
"github.com/Azure/terraform-provider-azurerm-restapi/internal/services/parse"
"github.com/Azure/terraform-provider-azurerm-restapi/internal/services/validate"
"github.com/Azure/terraform-provider-azurerm-restapi/internal/tf"
"github.com/Azure/terraform-provider-azurerm-restapi/utils"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/ms-henglu/terraform-provider-azurermg/internal/azure/identity"
"github.com/ms-henglu/terraform-provider-azurermg/internal/azure/location"
"github.com/ms-henglu/terraform-provider-azurermg/internal/azure/tags"
"github.com/ms-henglu/terraform-provider-azurermg/internal/clients"
"github.com/ms-henglu/terraform-provider-azurermg/internal/services/parse"
"github.com/ms-henglu/terraform-provider-azurermg/internal/services/validate"
"github.com/ms-henglu/terraform-provider-azurermg/internal/tf"
"github.com/ms-henglu/terraform-provider-azurermg/utils"
)
func ResourceAzureGenericDataSource() *schema.Resource {

Просмотреть файл

@ -4,16 +4,16 @@ import (
"fmt"
"testing"
"github.com/Azure/terraform-provider-azurerm-restapi/internal/acceptance"
"github.com/Azure/terraform-provider-azurerm-restapi/internal/acceptance/check"
"github.com/Azure/terraform-provider-azurerm-restapi/internal/azure/location"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/ms-henglu/terraform-provider-azurermg/internal/acceptance"
"github.com/ms-henglu/terraform-provider-azurermg/internal/acceptance/check"
"github.com/ms-henglu/terraform-provider-azurermg/internal/azure/location"
)
type GenericDataSource struct{}
func TestAccGenericDataSource_basic(t *testing.T) {
data := acceptance.BuildTestData(t, "azurermg_resource", "test")
data := acceptance.BuildTestData(t, "azurerm-restapi_resource", "test")
r := GenericDataSource{}
data.DataSourceTest(t, []resource.TestStep{
@ -36,9 +36,9 @@ func (r GenericDataSource) basic(data acceptance.TestData) string {
return fmt.Sprintf(`
%s
data "azurermg_resource" "test" {
resource_id = azurermg_resource.test.resource_id
type = azurermg_resource.test.type
data "azurerm-restapi_resource" "test" {
resource_id = azurerm-restapi_resource.test.resource_id
type = azurerm-restapi_resource.test.type
}
`, GenericResource{}.complete(data))
}

Просмотреть файл

@ -8,14 +8,14 @@ import (
"net/http"
"time"
"github.com/Azure/terraform-provider-azurerm-restapi/internal/azure"
"github.com/Azure/terraform-provider-azurerm-restapi/internal/clients"
"github.com/Azure/terraform-provider-azurerm-restapi/internal/services/parse"
"github.com/Azure/terraform-provider-azurerm-restapi/internal/services/validate"
"github.com/Azure/terraform-provider-azurerm-restapi/internal/tf"
"github.com/Azure/terraform-provider-azurerm-restapi/utils"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
"github.com/ms-henglu/terraform-provider-azurermg/internal/azure"
"github.com/ms-henglu/terraform-provider-azurermg/internal/clients"
"github.com/ms-henglu/terraform-provider-azurermg/internal/services/parse"
"github.com/ms-henglu/terraform-provider-azurermg/internal/services/validate"
"github.com/ms-henglu/terraform-provider-azurermg/internal/tf"
"github.com/ms-henglu/terraform-provider-azurermg/utils"
)
func ResourceAzureGenericPatchResource() *schema.Resource {
@ -26,7 +26,7 @@ func ResourceAzureGenericPatchResource() *schema.Resource {
Delete: resourceAzureGenericPatchResourceDelete,
Importer: tf.DefaultImporter(func(id string) error {
return fmt.Errorf("`azurermg_patch_resource` doesn't support import")
return fmt.Errorf("`azurerm-restapi_patch_resource` doesn't support import")
}),
Timeouts: &schema.ResourceTimeout{

Просмотреть файл

@ -6,19 +6,19 @@ import (
"net/http"
"testing"
"github.com/Azure/terraform-provider-azurerm-restapi/internal/acceptance"
"github.com/Azure/terraform-provider-azurerm-restapi/internal/acceptance/check"
"github.com/Azure/terraform-provider-azurerm-restapi/internal/clients"
"github.com/Azure/terraform-provider-azurerm-restapi/internal/services/parse"
"github.com/Azure/terraform-provider-azurerm-restapi/utils"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
"github.com/ms-henglu/terraform-provider-azurermg/internal/acceptance"
"github.com/ms-henglu/terraform-provider-azurermg/internal/acceptance/check"
"github.com/ms-henglu/terraform-provider-azurermg/internal/clients"
"github.com/ms-henglu/terraform-provider-azurermg/internal/services/parse"
"github.com/ms-henglu/terraform-provider-azurermg/utils"
)
type GenericPatchResource struct{}
func TestAccGenericPatchResource_loadBalancerNatRule(t *testing.T) {
data := acceptance.BuildTestData(t, "azurermg_patch_resource", "test")
data := acceptance.BuildTestData(t, "azurerm-restapi_patch_resource", "test")
r := GenericPatchResource{}
data.ResourceTest(t, r, []resource.TestStep{
@ -32,7 +32,7 @@ func TestAccGenericPatchResource_loadBalancerNatRule(t *testing.T) {
}
func TestAccGenericPatchResource_sqlServer(t *testing.T) {
data := acceptance.BuildTestData(t, "azurermg_patch_resource", "test")
data := acceptance.BuildTestData(t, "azurerm-restapi_patch_resource", "test")
r := GenericPatchResource{}
data.ResourceTest(t, r, []resource.TestStep{
@ -46,7 +46,7 @@ func TestAccGenericPatchResource_sqlServer(t *testing.T) {
}
func TestAccGenericPatchResource_springCloudApp(t *testing.T) {
data := acceptance.BuildTestData(t, "azurermg_patch_resource", "test")
data := acceptance.BuildTestData(t, "azurerm-restapi_patch_resource", "test")
r := GenericPatchResource{}
data.ResourceTest(t, r, []resource.TestStep{
@ -109,7 +109,7 @@ resource "azurerm_lb_nat_rule" "test" {
frontend_ip_configuration_name = "PublicIPAddress"
}
resource "azurermg_patch_resource" "test" {
resource "azurerm-restapi_patch_resource" "test" {
resource_id = azurerm_lb.test.id
type = "Microsoft.Network/loadBalancers@2021-03-01"
body = <<BODY
@ -146,7 +146,7 @@ resource "azurerm_sql_server" "test" {
administrator_login_password = "4-v3ry-53cr37-p455w0rd"
}
resource "azurermg_patch_resource" "test" {
resource "azurerm-restapi_patch_resource" "test" {
resource_id = azurerm_sql_server.test.id
type = "Microsoft.Sql/servers@2021-02-01-preview"
body = <<BODY
@ -180,7 +180,7 @@ resource "azurerm_spring_cloud_app" "test" {
}
}
resource "azurermg_patch_resource" "test" {
resource "azurerm-restapi_patch_resource" "test" {
resource_id = azurerm_spring_cloud_app.test.id
type = "Microsoft.AppPlatform/Spring/apps@2021-06-01-preview"
body = <<BODY

Просмотреть файл

@ -9,17 +9,17 @@ import (
"strings"
"time"
"github.com/Azure/terraform-provider-azurerm-restapi/internal/azure"
"github.com/Azure/terraform-provider-azurerm-restapi/internal/azure/identity"
"github.com/Azure/terraform-provider-azurerm-restapi/internal/azure/location"
"github.com/Azure/terraform-provider-azurerm-restapi/internal/azure/tags"
"github.com/Azure/terraform-provider-azurerm-restapi/internal/clients"
"github.com/Azure/terraform-provider-azurerm-restapi/internal/services/parse"
"github.com/Azure/terraform-provider-azurerm-restapi/internal/services/validate"
"github.com/Azure/terraform-provider-azurerm-restapi/internal/tf"
"github.com/Azure/terraform-provider-azurerm-restapi/utils"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
"github.com/ms-henglu/terraform-provider-azurermg/internal/azure"
"github.com/ms-henglu/terraform-provider-azurermg/internal/azure/identity"
"github.com/ms-henglu/terraform-provider-azurermg/internal/azure/location"
"github.com/ms-henglu/terraform-provider-azurermg/internal/azure/tags"
"github.com/ms-henglu/terraform-provider-azurermg/internal/clients"
"github.com/ms-henglu/terraform-provider-azurermg/internal/services/parse"
"github.com/ms-henglu/terraform-provider-azurermg/internal/services/validate"
"github.com/ms-henglu/terraform-provider-azurermg/internal/tf"
"github.com/ms-henglu/terraform-provider-azurermg/utils"
)
func ResourceAzureGenericResource() *schema.Resource {
@ -171,7 +171,7 @@ func resourceAzureGenericResourceCreateUpdate(d *schema.ResourceData, meta inter
}
}
if len(utils.GetId(existing)) > 0 {
return tf.ImportAsExistsError("azurermg_resource", id.ID())
return tf.ImportAsExistsError("azurerm-restapi_resource", id.ID())
}
}

Просмотреть файл

@ -6,13 +6,13 @@ import (
"net/http"
"testing"
"github.com/Azure/terraform-provider-azurerm-restapi/internal/acceptance"
"github.com/Azure/terraform-provider-azurerm-restapi/internal/acceptance/check"
"github.com/Azure/terraform-provider-azurerm-restapi/internal/clients"
"github.com/Azure/terraform-provider-azurerm-restapi/internal/services/parse"
"github.com/Azure/terraform-provider-azurerm-restapi/utils"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
"github.com/ms-henglu/terraform-provider-azurermg/internal/acceptance"
"github.com/ms-henglu/terraform-provider-azurermg/internal/acceptance/check"
"github.com/ms-henglu/terraform-provider-azurermg/internal/clients"
"github.com/ms-henglu/terraform-provider-azurermg/internal/services/parse"
"github.com/ms-henglu/terraform-provider-azurermg/utils"
)
type GenericResource struct{}
@ -22,7 +22,7 @@ func ignoredProperties() []string {
}
func TestAccGenericResource_basic(t *testing.T) {
data := acceptance.BuildTestData(t, "azurermg_resource", "test")
data := acceptance.BuildTestData(t, "azurerm-restapi_resource", "test")
r := GenericResource{}
data.ResourceTest(t, r, []resource.TestStep{
@ -37,7 +37,7 @@ func TestAccGenericResource_basic(t *testing.T) {
}
func TestAccGenericResource_requiresImport(t *testing.T) {
data := acceptance.BuildTestData(t, "azurermg_resource", "test")
data := acceptance.BuildTestData(t, "azurerm-restapi_resource", "test")
r := GenericResource{}
data.ResourceTest(t, r, []resource.TestStep{
@ -52,7 +52,7 @@ func TestAccGenericResource_requiresImport(t *testing.T) {
}
func TestAccGenericResource_complete(t *testing.T) {
data := acceptance.BuildTestData(t, "azurermg_resource", "test")
data := acceptance.BuildTestData(t, "azurerm-restapi_resource", "test")
r := GenericResource{}
data.ResourceTest(t, r, []resource.TestStep{
@ -67,7 +67,7 @@ func TestAccGenericResource_complete(t *testing.T) {
}
func TestAccGenericResource_completeBody(t *testing.T) {
data := acceptance.BuildTestData(t, "azurermg_resource", "test")
data := acceptance.BuildTestData(t, "azurerm-restapi_resource", "test")
r := GenericResource{}
data.ResourceTest(t, r, []resource.TestStep{
@ -82,7 +82,7 @@ func TestAccGenericResource_completeBody(t *testing.T) {
}
func TestAccGenericResource_identity(t *testing.T) {
data := acceptance.BuildTestData(t, "azurermg_resource", "test")
data := acceptance.BuildTestData(t, "azurerm-restapi_resource", "test")
r := GenericResource{}
data.ResourceTest(t, r, []resource.TestStep{
@ -147,7 +147,7 @@ resource "azurerm_container_registry" "test" {
admin_enabled = false
}
resource "azurermg_resource" "test" {
resource "azurerm-restapi_resource" "test" {
resource_id = "${azurerm_container_registry.test.id}/scopeMaps/acctest%[2]s"
type = "Microsoft.ContainerRegistry/registries/scopeMaps@2020-11-01-preview"
body = <<BODY
@ -168,9 +168,9 @@ func (r GenericResource) requiresImport(data acceptance.TestData) string {
return fmt.Sprintf(`
%s
resource "azurermg_resource" "import" {
resource_id = azurermg_resource.test.resource_id
type = azurermg_resource.test.type
resource "azurerm-restapi_resource" "import" {
resource_id = azurerm-restapi_resource.test.resource_id
type = azurerm-restapi_resource.test.type
body = <<BODY
{
"properties": {
@ -195,7 +195,7 @@ resource "azurerm_user_assigned_identity" "test" {
location = azurerm_resource_group.test.location
}
resource "azurermg_resource" "test" {
resource "azurerm-restapi_resource" "test" {
resource_id = "${azurerm_resource_group.test.id}/providers/Microsoft.ContainerRegistry/registries/acctest%[2]s"
type = "Microsoft.ContainerRegistry/registries@2020-11-01-preview"
location = "%[3]s"
@ -225,7 +225,7 @@ func (r GenericResource) completeBody(data acceptance.TestData) string {
return fmt.Sprintf(`
%s
provider "azurermg" {
provider "azurerm-restapi" {
schema_validation_enabled = false
}
@ -235,7 +235,7 @@ resource "azurerm_user_assigned_identity" "test" {
location = azurerm_resource_group.test.location
}
resource "azurermg_resource" "test" {
resource "azurerm-restapi_resource" "test" {
resource_id = "${azurerm_resource_group.test.id}/providers/Microsoft.ContainerRegistry/registries/acctest%[2]s"
type = "Microsoft.ContainerRegistry/registries@2020-11-01-preview"
@ -264,7 +264,7 @@ func (r GenericResource) identityNone(data acceptance.TestData) string {
return fmt.Sprintf(`
%s
resource "azurermg_resource" "test" {
resource "azurerm-restapi_resource" "test" {
resource_id = "${azurerm_resource_group.test.id}/providers/Microsoft.ContainerRegistry/registries/acctest%[2]s"
type = "Microsoft.ContainerRegistry/registries@2020-11-01-preview"
location = "%[3]s"
@ -286,7 +286,7 @@ func (r GenericResource) identitySystemAssigned(data acceptance.TestData) string
return fmt.Sprintf(`
%s
resource "azurermg_resource" "test" {
resource "azurerm-restapi_resource" "test" {
resource_id = "${azurerm_resource_group.test.id}/providers/Microsoft.ContainerRegistry/registries/acctest%[2]s"
type = "Microsoft.ContainerRegistry/registries@2020-11-01-preview"
location = "%[3]s"
@ -317,7 +317,7 @@ resource "azurerm_user_assigned_identity" "test" {
location = azurerm_resource_group.test.location
}
resource "azurermg_resource" "test" {
resource "azurerm-restapi_resource" "test" {
resource_id = "${azurerm_resource_group.test.id}/providers/Microsoft.ContainerRegistry/registries/acctest%[2]s"
type = "Microsoft.ContainerRegistry/registries@2020-11-01-preview"
location = "%[3]s"

Просмотреть файл

@ -5,8 +5,8 @@ import (
"net/url"
"strings"
"github.com/Azure/terraform-provider-azurerm-restapi/utils"
"github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids"
"github.com/ms-henglu/terraform-provider-azurermg/utils"
)
type ResourceId struct {

Просмотреть файл

@ -5,8 +5,8 @@ import (
"regexp"
"strings"
"github.com/Azure/terraform-provider-azurerm-restapi/internal/services/parse"
"github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids"
"github.com/ms-henglu/terraform-provider-azurermg/internal/services/parse"
)
func ResourceID(input interface{}, key string) (warnings []string, errors []error) {

Просмотреть файл

@ -3,7 +3,7 @@ package validate_test
import (
"testing"
"github.com/ms-henglu/terraform-provider-azurermg/internal/services/validate"
"github.com/Azure/terraform-provider-azurerm-restapi/internal/services/validate"
)
func TestResourceID(t *testing.T) {

Просмотреть файл

@ -3,7 +3,7 @@ package validate
import (
"fmt"
"github.com/ms-henglu/terraform-provider-azurermg/internal/services/parse"
"github.com/Azure/terraform-provider-azurerm-restapi/internal/services/parse"
)
func UserAssignedIdentityID(input interface{}, key string) (warnings []string, errors []error) {

Просмотреть файл

@ -1,8 +1,8 @@
package tf
import (
"github.com/Azure/terraform-provider-azurerm-restapi/utils"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/ms-henglu/terraform-provider-azurermg/utils"
)
func SuppressJsonOrderingDifference(_, old, new string, _ *schema.ResourceData) bool {

Просмотреть файл

@ -5,8 +5,8 @@ import (
"flag"
"log"
"github.com/Azure/terraform-provider-azurerm-restapi/internal/provider"
"github.com/hashicorp/terraform-plugin-sdk/v2/plugin"
"github.com/ms-henglu/terraform-provider-azurermg/internal/provider"
)
func main() {
@ -19,7 +19,7 @@ func main() {
flag.Parse()
if debugMode {
err := plugin.Debug(context.Background(), "registry.terraform.io/ms-henglu/azurerm-generic",
err := plugin.Debug(context.Background(), "registry.terraform.io/Azure/azurerm-restapi",
&plugin.ServeOpts{
ProviderFunc: provider.AzureProvider,
})

Просмотреть файл

@ -5,7 +5,7 @@ import (
"reflect"
"testing"
"github.com/ms-henglu/terraform-provider-azurermg/utils"
"github.com/Azure/terraform-provider-azurerm-restapi/utils"
)
func Test_GetMergedJson(t *testing.T) {
@ -52,8 +52,8 @@ func Test_GetMergedJson(t *testing.T) {
func Test_GetMergedJsonWithArray(t *testing.T) {
oldJson := `
{
"name": "henglulb",
"id": "/subscriptions/67a9759d-d099-4aa8-8675-e6cfd669c3f4/resourceGroups/henglu-rg1111/providers/Microsoft.Network/loadBalancers/henglulb",
"name": "mylb",
"id": "/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/rg/providers/Microsoft.Network/loadBalancers/mylb",
"etag": "W/\"0074bc84-d75b-4496-96c8-c858e0ef0afe\"",
"type": "Microsoft.Network/loadBalancers",
"location": "westus",
@ -64,18 +64,18 @@ func Test_GetMergedJsonWithArray(t *testing.T) {
"frontendIPConfigurations": [
{
"name": "PublicIPAddress",
"id": "/subscriptions/67a9759d-d099-4aa8-8675-e6cfd669c3f4/resourceGroups/henglu-rg1111/providers/Microsoft.Network/loadBalancers/henglulb/frontendIPConfigurations/PublicIPAddress",
"id": "/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/rg/providers/Microsoft.Network/loadBalancers/mylb/frontendIPConfigurations/PublicIPAddress",
"etag": "W/\"0074bc84-d75b-4496-96c8-c858e0ef0afe\"",
"type": "Microsoft.Network/loadBalancers/frontendIPConfigurations",
"properties": {
"provisioningState": "Succeeded",
"privateIPAllocationMethod": "Dynamic",
"publicIPAddress": {
"id": "/subscriptions/67a9759d-d099-4aa8-8675-e6cfd669c3f4/resourceGroups/henglu-rg1111/providers/Microsoft.Network/publicIPAddresses/hengluIp"
"id": "/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/rg/providers/Microsoft.Network/publicIPAddresses/myip"
},
"inboundNatRules": [
{
"id": "/subscriptions/67a9759d-d099-4aa8-8675-e6cfd669c3f4/resourceGroups/henglu-rg1111/providers/Microsoft.Network/loadBalancers/henglulb/inboundNatRules/RDPAccess"
"id": "/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/rg/providers/Microsoft.Network/loadBalancers/mylb/inboundNatRules/RDPAccess"
}
]
}
@ -87,13 +87,13 @@ func Test_GetMergedJsonWithArray(t *testing.T) {
"inboundNatRules": [
{
"name": "RDPAccess",
"id": "/subscriptions/67a9759d-d099-4aa8-8675-e6cfd669c3f4/resourceGroups/henglu-rg1111/providers/Microsoft.Network/loadBalancers/henglulb/inboundNatRules/RDPAccess",
"id": "/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/rg/providers/Microsoft.Network/loadBalancers/mylb/inboundNatRules/RDPAccess",
"etag": "W/\"0074bc84-d75b-4496-96c8-c858e0ef0afe\"",
"type": "Microsoft.Network/loadBalancers/inboundNatRules",
"properties": {
"provisioningState": "Succeeded",
"frontendIPConfiguration": {
"id": "/subscriptions/67a9759d-d099-4aa8-8675-e6cfd669c3f4/resourceGroups/henglu-rg1111/providers/Microsoft.Network/loadBalancers/henglulb/frontendIPConfigurations/PublicIPAddress"
"id": "/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/rg/providers/Microsoft.Network/loadBalancers/mylb/frontendIPConfigurations/PublicIPAddress"
},
"frontendPort": 3389,
"backendPort": 3389,
@ -130,8 +130,8 @@ func Test_GetMergedJsonWithArray(t *testing.T) {
expectedJson := `
{
"name": "henglulb",
"id": "/subscriptions/67a9759d-d099-4aa8-8675-e6cfd669c3f4/resourceGroups/henglu-rg1111/providers/Microsoft.Network/loadBalancers/henglulb",
"name": "mylb",
"id": "/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/rg/providers/Microsoft.Network/loadBalancers/mylb",
"etag": "W/\"0074bc84-d75b-4496-96c8-c858e0ef0afe\"",
"type": "Microsoft.Network/loadBalancers",
"location": "westus",
@ -142,18 +142,18 @@ func Test_GetMergedJsonWithArray(t *testing.T) {
"frontendIPConfigurations": [
{
"name": "PublicIPAddress",
"id": "/subscriptions/67a9759d-d099-4aa8-8675-e6cfd669c3f4/resourceGroups/henglu-rg1111/providers/Microsoft.Network/loadBalancers/henglulb/frontendIPConfigurations/PublicIPAddress",
"id": "/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/rg/providers/Microsoft.Network/loadBalancers/mylb/frontendIPConfigurations/PublicIPAddress",
"etag": "W/\"0074bc84-d75b-4496-96c8-c858e0ef0afe\"",
"type": "Microsoft.Network/loadBalancers/frontendIPConfigurations",
"properties": {
"provisioningState": "Succeeded",
"privateIPAllocationMethod": "Dynamic",
"publicIPAddress": {
"id": "/subscriptions/67a9759d-d099-4aa8-8675-e6cfd669c3f4/resourceGroups/henglu-rg1111/providers/Microsoft.Network/publicIPAddresses/hengluIp"
"id": "/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/rg/providers/Microsoft.Network/publicIPAddresses/myip"
},
"inboundNatRules": [
{
"id": "/subscriptions/67a9759d-d099-4aa8-8675-e6cfd669c3f4/resourceGroups/henglu-rg1111/providers/Microsoft.Network/loadBalancers/henglulb/inboundNatRules/RDPAccess"
"id": "/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/rg/providers/Microsoft.Network/loadBalancers/mylb/inboundNatRules/RDPAccess"
}
]
}
@ -165,13 +165,13 @@ func Test_GetMergedJsonWithArray(t *testing.T) {
"inboundNatRules": [
{
"name": "RDPAccess",
"id": "/subscriptions/67a9759d-d099-4aa8-8675-e6cfd669c3f4/resourceGroups/henglu-rg1111/providers/Microsoft.Network/loadBalancers/henglulb/inboundNatRules/RDPAccess",
"id": "/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/rg/providers/Microsoft.Network/loadBalancers/mylb/inboundNatRules/RDPAccess",
"etag": "W/\"0074bc84-d75b-4496-96c8-c858e0ef0afe\"",
"type": "Microsoft.Network/loadBalancers/inboundNatRules",
"properties": {
"provisioningState": "Succeeded",
"frontendIPConfiguration": {
"id": "/subscriptions/67a9759d-d099-4aa8-8675-e6cfd669c3f4/resourceGroups/henglu-rg1111/providers/Microsoft.Network/loadBalancers/henglulb/frontendIPConfigurations/PublicIPAddress"
"id": "/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/rg/providers/Microsoft.Network/loadBalancers/mylb/frontendIPConfigurations/PublicIPAddress"
},
"frontendPort": 3389,
"backendPort": 3389,
@ -211,7 +211,7 @@ func Test_GetRemovedJson(t *testing.T) {
"properties": {
"public": false,
"provisioningState": "Succeeded",
"fqdn": "henglu1116-springcloud.azuremicroservices.io",
"fqdn": "springcloud.azuremicroservices.io",
"httpsOnly": false,
"createdTime": "2021-11-16T08:49:54.966Z",
"temporaryDisk": {
@ -231,8 +231,8 @@ func Test_GetRemovedJson(t *testing.T) {
"tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47"
},
"location": "westeurope",
"id": "/subscriptions/67a9759d-d099-4aa8-8675-e6cfd669c3f4/resourceGroups/acctestRG-henglu1116/providers/Microsoft.AppPlatform/Spring/henglu1116-springcloud/apps/henglu1116-springcloudapp",
"name": "henglu1116-springcloudapp"
"id": "/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/acctestRG1116/providers/Microsoft.AppPlatform/Spring/springcloud/apps/springcloudapp",
"name": "springcloudapp"
}
`
@ -251,7 +251,7 @@ func Test_GetRemovedJson(t *testing.T) {
"properties": {
"public": false,
"provisioningState": "Succeeded",
"fqdn": "henglu1116-springcloud.azuremicroservices.io",
"fqdn": "springcloud.azuremicroservices.io",
"httpsOnly": false,
"createdTime": "2021-11-16T08:49:54.966Z",
"persistentDisk": {
@ -267,8 +267,8 @@ func Test_GetRemovedJson(t *testing.T) {
"tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47"
},
"location": "westeurope",
"id": "/subscriptions/67a9759d-d099-4aa8-8675-e6cfd669c3f4/resourceGroups/acctestRG-henglu1116/providers/Microsoft.AppPlatform/Spring/henglu1116-springcloud/apps/henglu1116-springcloudapp",
"name": "henglu1116-springcloudapp"
"id": "/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/acctestRG1116/providers/Microsoft.AppPlatform/Spring/springcloud/apps/springcloudapp",
"name": "springcloudapp"
}
`
var new, old, expected interface{}
@ -287,17 +287,17 @@ func Test_GetRemovedJson(t *testing.T) {
func Test_GetIgnoredJson(t *testing.T) {
oldJson := `
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/acctestRG-henglu924/providers/Microsoft.Kusto/Clusters/acctestkchenglu924/Databases/acctestkd-henglu924/DataConnections/acctestkedc-henglu924",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/acctestRG924/providers/Microsoft.Kusto/Clusters/acctestkc924/Databases/acctestkd/DataConnections/acctestkedc",
"kind": "EventHub",
"location": "West Europe",
"name": "acctestkchenglu924/acctestkd-henglu924/acctestkedc-henglu924",
"name": "acctestkc924/acctestkd/acctestkedc",
"properties": {
"compression": "None",
"consumerGroup": "acctesteventhubcg-henglu924",
"consumerGroup": "acctesteventhubcg",
"dataFormat": "",
"eventHubResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/acctestRG-henglu924/providers/Microsoft.EventHub/namespaces/acctesteventhubnamespace-henglu924/eventhubs/acctesteventhub-henglu924",
"eventHubResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/acctestRG924/providers/Microsoft.EventHub/namespaces/acctesteventhubnamespace/eventhubs/acctesteventhub",
"eventSystemProperties": [],
"managedIdentityResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/acctestRG-henglu924/providers/Microsoft.ManagedIdentity/userAssignedIdentities/acctesthenglu924",
"managedIdentityResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/acctestRG924/providers/Microsoft.ManagedIdentity/userAssignedIdentities/acctest924",
"mappingRuleName": "",
"provisioningState": "Succeeded",
"tableName": ""
@ -307,17 +307,17 @@ func Test_GetIgnoredJson(t *testing.T) {
`
expectedJson := `
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/acctestRG-henglu924/providers/Microsoft.Kusto/Clusters/acctestkchenglu924/Databases/acctestkd-henglu924/DataConnections/acctestkedc-henglu924",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/acctestRG924/providers/Microsoft.Kusto/Clusters/acctestkc924/Databases/acctestkd/DataConnections/acctestkedc",
"kind": "EventHub",
"location": "West Europe",
"name": "acctestkchenglu924/acctestkd-henglu924/acctestkedc-henglu924",
"name": "acctestkc924/acctestkd/acctestkedc",
"properties": {
"compression": "None",
"consumerGroup": "acctesteventhubcg-henglu924",
"consumerGroup": "acctesteventhubcg",
"dataFormat": "",
"eventHubResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/acctestRG-henglu924/providers/Microsoft.EventHub/namespaces/acctesteventhubnamespace-henglu924/eventhubs/acctesteventhub-henglu924",
"eventHubResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/acctestRG924/providers/Microsoft.EventHub/namespaces/acctesteventhubnamespace/eventhubs/acctesteventhub",
"eventSystemProperties": [],
"managedIdentityResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/acctestRG-henglu924/providers/Microsoft.ManagedIdentity/userAssignedIdentities/acctesthenglu924",
"managedIdentityResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/acctestRG924/providers/Microsoft.ManagedIdentity/userAssignedIdentities/acctest924",
"mappingRuleName": "",
"tableName": ""
},
@ -340,17 +340,17 @@ func Test_GetIgnoredJson(t *testing.T) {
func Test_ExtractObject(t *testing.T) {
oldJson := `
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/acctestRG-henglu924/providers/Microsoft.Kusto/Clusters/acctestkchenglu924/Databases/acctestkd-henglu924/DataConnections/acctestkedc-henglu924",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/acctestRG924/providers/Microsoft.Kusto/Clusters/acctestkc924/Databases/acctestkd/DataConnections/acctestkedc",
"kind": "EventHub",
"location": "West Europe",
"name": "acctestkchenglu924/acctestkd-henglu924/acctestkedc-henglu924",
"name": "acctestkc924/acctestkd/acctestkedc",
"properties": {
"compression": "None",
"consumerGroup": "acctesteventhubcg-henglu924",
"consumerGroup": "acctesteventhubcg",
"dataFormat": "",
"eventHubResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/acctestRG-henglu924/providers/Microsoft.EventHub/namespaces/acctesteventhubnamespace-henglu924/eventhubs/acctesteventhub-henglu924",
"eventHubResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/acctestRG924/providers/Microsoft.EventHub/namespaces/acctesteventhubnamespace/eventhubs/acctesteventhub",
"eventSystemProperties": [],
"managedIdentityResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/acctestRG-henglu924/providers/Microsoft.ManagedIdentity/userAssignedIdentities/acctesthenglu924",
"managedIdentityResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/acctestRG924/providers/Microsoft.ManagedIdentity/userAssignedIdentities/acctest924",
"mappingRuleName": "",
"provisioningState": "Succeeded",
"tableName": ""
@ -361,7 +361,7 @@ func Test_ExtractObject(t *testing.T) {
expectedJson := `
{
"properties": {
"consumerGroup": "acctesteventhubcg-henglu924"
"consumerGroup": "acctesteventhubcg"
}
}
`

Просмотреть файл

@ -1,12 +1,12 @@
---
subcategory: ""
layout: "azurermg"
page_title: "Generic Azure Data Source: azurermg_resource"
layout: "azurerm-restapi"
page_title: "Generic Azure Data Source: azurerm-restapi_resource"
description: |-
Gets information from an existing azure resource
---
# azurermg_resource
# azurerm-restapi_resource
This resource can access any existing Azure resource manager resource.
@ -15,13 +15,13 @@ This resource can access any existing Azure resource manager resource.
```hcl
terraform {
required_providers {
azurermg = {
source = "ms-henglu/azurermg"
azurerm-restapi = {
source = "Azure/azurerm-restapi"
}
}
}
provider "azurermg" {
provider "azurerm-restapi" {
}
provider "azurerm" {
@ -41,7 +41,7 @@ resource "azurerm_container_registry" "example" {
admin_enabled = false
}
data "azurermg_resource" "test" {
data "azurerm-restapi_resource" "example" {
resource_id = azurerm_container_registry.example.id
type = "Microsoft.ContainerRegistry/registries@2020-11-01-preview"
@ -50,12 +50,12 @@ data "azurermg_resource" "test" {
// it will output "registry1.azurecr.io"
output "login_server" {
value = jsondecode(data.azurermg_resource.test.output).properties.loginServer
value = jsondecode(data.azurerm-restapi_resource.example.output).properties.loginServer
}
// it will output "disabled"
output "quarantine_policy" {
value = jsondecode(data.azurermg_resource.test.output).properties.policies.quarantinePolicy.status
value = jsondecode(data.azurerm-restapi_resource.example.output).properties.policies.quarantinePolicy.status
}
```
@ -102,12 +102,12 @@ In addition to the Arguments listed above - the following Attributes are exporte
```
// it will output "registry1.azurecr.io"
output "login_server" {
value = jsondecode(azurermg_resource.test.output).properties.loginServer
value = jsondecode(azurerm-restapi_resource.example.output).properties.loginServer
}
// it will output "disabled"
output "quarantine_policy" {
value = jsondecode(azurermg_resource.test.output).properties.policies.quarantinePolicy.status
value = jsondecode(azurerm-restapi_resource.example.output).properties.policies.quarantinePolicy.status
}
```

Просмотреть файл

@ -1,19 +1,19 @@
---
layout: "azurermg"
layout: "azurerm-restapi"
page_title: "Provider: Azure"
description: |-
The Generic Azure Provider is used to interact with the many resources supported by Azure Resource Manager (also known as AzureRM) through its APIs.
The AzureRM Rest API Provider is used to interact with the many resources supported by Azure Resource Manager (also known as AzureRM) through its APIs.
---
# Generic Azure Provider
# AzureRM Rest API Provider
The Generic Azure Provider can be used to configure infrastructure in [Microsoft Azure](https://azure.microsoft.com/en-us/) using the Azure Resource Manager API's. Documentation regarding the [Data Sources](/docs/configuration/data-sources.html) and [Resources](/docs/configuration/resources.html) supported by the Azure Provider can be found in the navigation to the left.
The AzureRM Rest API Provider can be used to configure infrastructure in [Microsoft Azure](https://azure.microsoft.com/en-us/) using the Azure Resource Manager API's. Documentation regarding the [Data Sources](/docs/configuration/data-sources.html) and [Resources](/docs/configuration/resources.html) supported by the Azure Provider can be found in the navigation to the left.
To learn the basics of Terraform using this provider, follow the
hands-on [get started tutorials](https://learn.hashicorp.com/tutorials/terraform/infrastructure-as-code?in=terraform/azure-get-started) on HashiCorp's Learn platform.
Interested in the provider's latest features, or want to make sure you're up to date? Check out the [changelog](https://github.com/ms-henglu/terraform-provider-azurerm-generic/blob/develop/CHANGELOG.md) for version information and release notes.
Interested in the provider's latest features, or want to make sure you're up to date? Check out the [changelog](https://github.com/Azure/terraform-provider-azurerm-generic/blob/develop/CHANGELOG.md) for version information and release notes.
## Authenticating to Azure
@ -35,13 +35,13 @@ We recommend using either a Service Principal or Managed Service Identity when r
# Azure Provider source and version being used
terraform {
required_providers {
azurerm = {
source = "ms-henglu/azurermg"
azurerm-restapi = {
source = "Azure/azurerm-restapi"
}
}
}
provider "azurermg" {
provider "azurerm-restapi" {
}
```

Просмотреть файл

@ -1,12 +1,12 @@
---
subcategory: ""
layout: "azurermg"
page_title: "Generic Azure Patch Resource: azurermg_patch_resource"
layout: "azurerm-restapi"
page_title: "Generic Azure Patch Resource: azurerm-restapi_patch_resource"
description: |-
Manages a subset of an existing azure resource's properties
---
# azurermg_resource
# azurerm-restapi_resource
This resource can manage a subset of any existing Azure resource manager resource's properties.
@ -15,13 +15,13 @@ This resource can manage a subset of any existing Azure resource manager resourc
```hcl
terraform {
required_providers {
azurermg = {
source = "ms-henglu/azurermg"
azurerm-restapi = {
source = "Azure/azurerm-restapi"
}
}
}
provider "azurermg" {
provider "azurerm-restapi" {
}
provider "azurerm" {
@ -61,7 +61,7 @@ resource "azurerm_lb_nat_rule" "example" {
frontend_ip_configuration_name = "PublicIPAddress"
}
resource "azurermg_patch_resource" "example" {
resource "azurerm-restapi_patch_resource" "example" {
resource_id = azurerm_lb.example.id
type = "Microsoft.Network/loadBalancers@2021-03-01"
body = <<BODY
@ -79,7 +79,7 @@ resource "azurermg_patch_resource" "example" {
BODY
depends_on = [
azurerm_lb_nat_rule.test,
azurerm_lb_nat_rule.example,
]
}
@ -127,12 +127,12 @@ In addition to the Arguments listed above - the following Attributes are exporte
```
// it will output "registry1.azurecr.io"
output "login_server" {
value = jsondecode(azurermg_resource.test.output).properties.loginServer
value = jsondecode(azurerm-restapi_resource.example.output).properties.loginServer
}
// it will output "disabled"
output "quarantine_policy" {
value = jsondecode(azurermg_resource.test.output).properties.policies.quarantinePolicy.status
value = jsondecode(azurerm-restapi_resource.example.output).properties.policies.quarantinePolicy.status
}
```

Просмотреть файл

@ -1,12 +1,12 @@
---
subcategory: ""
layout: "azurermg"
page_title: "Generic Azure Resource: azurermg_resource"
layout: "azurerm-restapi"
page_title: "Generic Azure Resource: azurerm-restapi_resource"
description: |-
Manages a Azure resource
---
# azurermg_resource
# azurerm-restapi_resource
This resource can manage any Azure resource manager resource.
@ -15,13 +15,13 @@ This resource can manage any Azure resource manager resource.
```hcl
terraform {
required_providers {
azurermg = {
source = "ms-henglu/azurermg"
azurerm-restapi = {
source = "Azure/azurerm-restapi"
}
}
}
provider "azurermg" {
provider "azurerm-restapi" {
}
provider "azurerm" {
@ -40,8 +40,8 @@ resource "azurerm_user_assigned_identity" "example" {
}
// manage a container registry resource
resource "azurermg_resource" "example" {
resource_id = "${azurerm_resource_group.test.id}/providers/Microsoft.ContainerRegistry/registries/registry1"
resource "azurerm-restapi_resource" "example" {
resource_id = "${azurerm_resource_group.example.id}/providers/Microsoft.ContainerRegistry/registries/registry1"
type = "Microsoft.ContainerRegistry/registries@2020-11-01-preview"
location = azurerm_resource_group.example.location
identity {
@ -69,12 +69,12 @@ resource "azurermg_resource" "example" {
// it will output "registry1.azurecr.io"
output "login_server" {
value = jsondecode(azurermg_resource.test.output).properties.loginServer
value = jsondecode(azurerm-restapi_resource.example.output).properties.loginServer
}
// it will output "disabled"
output "quarantine_policy" {
value = jsondecode(azurermg_resource.test.output).properties.policies.quarantinePolicy.status
value = jsondecode(azurerm-restapi_resource.example.output).properties.policies.quarantinePolicy.status
}
```
@ -139,12 +139,12 @@ In addition to the Arguments listed above - the following Attributes are exporte
```
// it will output "registry1.azurecr.io"
output "login_server" {
value = jsondecode(azurermg_resource.test.output).properties.loginServer
value = jsondecode(azurerm-restapi_resource.example.output).properties.loginServer
}
// it will output "disabled"
output "quarantine_policy" {
value = jsondecode(azurermg_resource.test.output).properties.policies.quarantinePolicy.status
value = jsondecode(azurerm-restapi_resource.example.output).properties.policies.quarantinePolicy.status
}
```
@ -170,5 +170,5 @@ The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/d
Azure resource can be imported using the `resource id`, e.g.
```shell
terraform import azurermg_resource.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resGroup1/providers/Microsoft.MachineLearningServices/workspaces/workspace1/computes/cluster1?api-version=2021-07-01
terraform import azurerm-restapi_resource.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resGroup1/providers/Microsoft.MachineLearningServices/workspaces/workspace1/computes/cluster1?api-version=2021-07-01
```