From d7f7872ce7d5a8171f747e10f24d4c10f88269b8 Mon Sep 17 00:00:00 2001 From: Heng Lu Date: Fri, 2 Feb 2024 09:59:30 +0800 Subject: [PATCH 1/3] new resource: `azurerm_spring_cloud_app_dynamics_application_performance_monitoring` --- ...ication_performance_monitoring_resource.go | 395 ++++++++++++++++++ ...on_performance_monitoring_resource_test.go | 174 ++++++++ ...ation_performance_monitoring.html.markdown | 101 +++++ 3 files changed, 670 insertions(+) create mode 100644 internal/services/springcloud/spring_cloud_app_dynamics_application_performance_monitoring_resource.go create mode 100644 internal/services/springcloud/spring_cloud_app_dynamics_application_performance_monitoring_resource_test.go create mode 100644 website/docs/r/spring_cloud_app_dynamics_application_performance_monitoring.html.markdown diff --git a/internal/services/springcloud/spring_cloud_app_dynamics_application_performance_monitoring_resource.go b/internal/services/springcloud/spring_cloud_app_dynamics_application_performance_monitoring_resource.go new file mode 100644 index 000000000000..99cb909847ac --- /dev/null +++ b/internal/services/springcloud/spring_cloud_app_dynamics_application_performance_monitoring_resource.go @@ -0,0 +1,395 @@ +package springcloud + +import ( + "context" + "fmt" + "strconv" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/appplatform/2023-11-01-preview/appplatform" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" +) + +type SpringCloudAppDynamicsApplicationPerformanceMonitoringModel struct { + Name string `tfschema:"name"` + SpringCloudServiceId string `tfschema:"spring_cloud_service_id"` + GloballyEnabled bool `tfschema:"globally_enabled"` + AgentApplicationName string `tfschema:"agent_application_name"` + AgentTierName string `tfschema:"agent_tier_name"` + AgentNodeName string `tfschema:"agent_node_name"` + AgentUniqueHostId string `tfschema:"agent_unique_host_id"` + ControllerHostName string `tfschema:"controller_host_name"` + ControllerSslEnabled bool `tfschema:"controller_ssl_enabled"` + ControllerPort int `tfschema:"controller_port"` + AgentAccountName string `tfschema:"agent_account_name"` + AgentAccountAccessKey string `tfschema:"agent_account_access_key"` +} + +type SpringCloudAppDynamicsApplicationPerformanceMonitoringResource struct{} + +var _ sdk.ResourceWithUpdate = SpringCloudAppDynamicsApplicationPerformanceMonitoringResource{} + +func (s SpringCloudAppDynamicsApplicationPerformanceMonitoringResource) ResourceType() string { + return "azurerm_spring_cloud_app_dynamics_application_performance_monitoring" +} + +func (s SpringCloudAppDynamicsApplicationPerformanceMonitoringResource) ModelObject() interface{} { + return &SpringCloudAppDynamicsApplicationPerformanceMonitoringModel{} +} + +func (s SpringCloudAppDynamicsApplicationPerformanceMonitoringResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return appplatform.ValidateApmID +} + +func (s SpringCloudAppDynamicsApplicationPerformanceMonitoringResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "spring_cloud_service_id": commonschema.ResourceIDReferenceRequiredForceNew(&commonids.SpringCloudServiceId{}), + + "agent_account_access_key": { + Type: pluginsdk.TypeString, + Required: true, + Sensitive: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "agent_account_name": { + Type: pluginsdk.TypeString, + Required: true, + Sensitive: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "controller_host_name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "agent_application_name": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "agent_tier_name": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "agent_node_name": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "agent_unique_host_id": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "controller_ssl_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + }, + + "controller_port": { + Type: pluginsdk.TypeInt, + Optional: true, + ValidateFunc: validation.IntBetween(1, 65535), + }, + + "globally_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + }, + } +} + +func (s SpringCloudAppDynamicsApplicationPerformanceMonitoringResource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{} +} + +func (s SpringCloudAppDynamicsApplicationPerformanceMonitoringResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + var model SpringCloudAppDynamicsApplicationPerformanceMonitoringModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + client := metadata.Client.AppPlatform.AppPlatformClient + springId, err := commonids.ParseSpringCloudServiceID(model.SpringCloudServiceId) + if err != nil { + return err + } + id := appplatform.NewApmID(springId.SubscriptionId, springId.ResourceGroupName, springId.ServiceName, model.Name) + + existing, err := client.ApmsGet(ctx, id) + if err != nil && !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for existing %s: %+v", id, err) + } + if !response.WasNotFound(existing.HttpResponse) { + return metadata.ResourceRequiresImport(s.ResourceType(), id) + } + + resource := appplatform.ApmResource{ + Properties: &appplatform.ApmProperties{ + Type: "AppDynamics", + Properties: pointer.To(map[string]string{ + "agent_application_name": model.AgentApplicationName, + "agent_tier_name": model.AgentTierName, + "agent_node_name": model.AgentNodeName, + "agent_unique_host_id": model.AgentUniqueHostId, + "controller_host_name": model.ControllerHostName, + "controller_ssl_enabled": fmt.Sprintf("%t", model.ControllerSslEnabled), + "controller_port": fmt.Sprintf("%d", model.ControllerPort), + }), + Secrets: pointer.To(map[string]string{ + "agent_account_name": model.AgentAccountName, + "agent_account_access_key": model.AgentAccountAccessKey, + }), + }, + } + err = client.ApmsCreateOrUpdateThenPoll(ctx, id, resource) + if err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + metadata.SetID(id) + + if model.GloballyEnabled { + apmReference := appplatform.ApmReference{ + ResourceId: id.ID(), + } + err = client.ServicesEnableApmGloballyThenPoll(ctx, *springId, apmReference) + if err != nil { + return fmt.Errorf("enabling %s globally: %+v", id, err) + } + } + + return nil + }, + } +} + +func (s SpringCloudAppDynamicsApplicationPerformanceMonitoringResource) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.AppPlatform.AppPlatformClient + + id, err := appplatform.ParseApmID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + var model SpringCloudAppDynamicsApplicationPerformanceMonitoringModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + resp, err := client.ApmsGet(ctx, *id) + if err != nil { + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + properties := resp.Model.Properties + if properties == nil { + return fmt.Errorf("retrieving %s: properties was nil", id) + } + if properties.Properties == nil { + properties.Properties = pointer.To(map[string]string{}) + } + if properties.Secrets == nil { + properties.Secrets = pointer.To(map[string]string{}) + } + + if metadata.ResourceData.HasChange("agent_application_name") { + (*properties.Properties)["agent_application_name"] = model.AgentApplicationName + } + + if metadata.ResourceData.HasChange("agent_tier_name") { + (*properties.Properties)["agent_tier_name"] = model.AgentTierName + } + + if metadata.ResourceData.HasChange("agent_node_name") { + (*properties.Properties)["agent_node_name"] = model.AgentNodeName + } + + if metadata.ResourceData.HasChange("agent_unique_host_id") { + (*properties.Properties)["agent_unique_host_id"] = model.AgentUniqueHostId + } + + if metadata.ResourceData.HasChange("controller_host_name") { + (*properties.Properties)["controller_host_name"] = model.ControllerHostName + } + + if metadata.ResourceData.HasChange("controller_ssl_enabled") { + (*properties.Properties)["controller_ssl_enabled"] = fmt.Sprintf("%t", model.ControllerSslEnabled) + } + + if metadata.ResourceData.HasChange("controller_port") { + (*properties.Properties)["controller_port"] = fmt.Sprintf("%d", model.ControllerPort) + } + + if metadata.ResourceData.HasChange("agent_account_name") { + (*properties.Secrets)["agent_account_name"] = model.AgentAccountName + } + + if metadata.ResourceData.HasChange("agent_account_access_key") { + (*properties.Secrets)["agent_account_access_key"] = model.AgentAccountAccessKey + } + + resource := appplatform.ApmResource{ + Properties: properties, + } + + err = client.ApmsCreateOrUpdateThenPoll(ctx, *id, resource) + if err != nil { + return fmt.Errorf("updating %s: %+v", id, err) + } + + if metadata.ResourceData.HasChange("globally_enabled") { + apmReference := appplatform.ApmReference{ + ResourceId: id.ID(), + } + springId := commonids.NewSpringCloudServiceID(id.SubscriptionId, id.ResourceGroupName, id.SpringName) + if model.GloballyEnabled { + err := client.ServicesEnableApmGloballyThenPoll(ctx, springId, apmReference) + if err != nil { + return fmt.Errorf("enabling %s globally: %+v", id, err) + } + } else { + err := client.ServicesDisableApmGloballyThenPoll(ctx, springId, apmReference) + if err != nil { + return fmt.Errorf("disabling %s globally: %+v", id, err) + } + } + } + + return nil + }, + } +} + +func (s SpringCloudAppDynamicsApplicationPerformanceMonitoringResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.AppPlatform.AppPlatformClient + + id, err := appplatform.ParseApmID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + resp, err := client.ApmsGet(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return metadata.MarkAsGone(id) + } + + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + springId := commonids.NewSpringCloudServiceID(id.SubscriptionId, id.ResourceGroupName, id.SpringName) + result, err := client.ServicesListGloballyEnabledApms(ctx, springId) + if err != nil { + return fmt.Errorf("listing globally enabled apms: %+v", err) + } + globallyEnabled := false + if result.Model != nil && result.Model.Value != nil { + for _, value := range *result.Model.Value { + apmId, err := appplatform.ParseApmIDInsensitively(value) + if err == nil && apmId.ID() == id.ID() { + globallyEnabled = true + break + } + } + } + + var model SpringCloudAppDynamicsApplicationPerformanceMonitoringModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + state := SpringCloudAppDynamicsApplicationPerformanceMonitoringModel{ + Name: id.ApmName, + SpringCloudServiceId: springId.ID(), + GloballyEnabled: globallyEnabled, + AgentAccountName: model.AgentAccountName, + AgentAccountAccessKey: model.AgentAccountAccessKey, + } + + if props := resp.Model.Properties; props != nil { + if props.Type != "AppDynamics" { + return fmt.Errorf("retrieving %s: expected type AppDynamics, got %s", *id, props.Type) + } + if props.Properties != nil { + if value, ok := (*props.Properties)["agent_application_name"]; ok { + state.AgentApplicationName = value + } + if value, ok := (*props.Properties)["agent_tier_name"]; ok { + state.AgentTierName = value + } + if value, ok := (*props.Properties)["agent_node_name"]; ok { + state.AgentNodeName = value + } + if value, ok := (*props.Properties)["agent_unique_host_id"]; ok { + state.AgentUniqueHostId = value + } + if value, ok := (*props.Properties)["controller_host_name"]; ok { + state.ControllerHostName = value + } + if value, ok := (*props.Properties)["controller_ssl_enabled"]; ok { + state.ControllerSslEnabled = value == "true" + } + if value, ok := (*props.Properties)["controller_port"]; ok { + if v, err := strconv.ParseInt(value, 10, 32); err == nil { + state.ControllerPort = int(v) + } + } + } + } + + return metadata.Encode(&state) + }, + } +} + +func (s SpringCloudAppDynamicsApplicationPerformanceMonitoringResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.AppPlatform.AppPlatformClient + + id, err := appplatform.ParseApmID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + err = client.ApmsDeleteThenPoll(ctx, *id) + if err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) + } + + return nil + }, + } +} diff --git a/internal/services/springcloud/spring_cloud_app_dynamics_application_performance_monitoring_resource_test.go b/internal/services/springcloud/spring_cloud_app_dynamics_application_performance_monitoring_resource_test.go new file mode 100644 index 000000000000..d624e7979f8e --- /dev/null +++ b/internal/services/springcloud/spring_cloud_app_dynamics_application_performance_monitoring_resource_test.go @@ -0,0 +1,174 @@ +package springcloud_test + +import ( + "context" + "fmt" + "testing" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/appplatform/2023-11-01-preview/appplatform" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type SpringCloudAppDynamicsApplicationPerformanceMonitoringResource struct{} + +func TestAccSpringCloudAppDynamicsApplicationPerformanceMonitoring_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_spring_cloud_app_dynamics_application_performance_monitoring", "test") + r := SpringCloudAppDynamicsApplicationPerformanceMonitoringResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep("agent_account_name", "agent_account_access_key"), + }) +} + +func TestAccSpringCloudAppDynamicsApplicationPerformanceMonitoring_requiresImport(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_spring_cloud_app_dynamics_application_performance_monitoring", "test") + r := SpringCloudAppDynamicsApplicationPerformanceMonitoringResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.RequiresImportErrorStep(r.requiresImport), + }) +} + +func TestAccSpringCloudAppDynamicsApplicationPerformanceMonitoring_complete(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_spring_cloud_app_dynamics_application_performance_monitoring", "test") + r := SpringCloudAppDynamicsApplicationPerformanceMonitoringResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep("agent_account_name", "agent_account_access_key"), + }) +} + +func TestAccSpringCloudAppDynamicsApplicationPerformanceMonitoring_update(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_spring_cloud_app_dynamics_application_performance_monitoring", "test") + r := SpringCloudAppDynamicsApplicationPerformanceMonitoringResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep("agent_account_name", "agent_account_access_key"), + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep("agent_account_name", "agent_account_access_key"), + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep("agent_account_name", "agent_account_access_key"), + }) +} + +func (r SpringCloudAppDynamicsApplicationPerformanceMonitoringResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := appplatform.ParseApmID(state.ID) + if err != nil { + return nil, err + } + resp, err := client.AppPlatform.AppPlatformClient.ApmsGet(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return utils.Bool(false), nil + } + return nil, fmt.Errorf("retrieving %s: %+v", id, err) + } + return utils.Bool(resp.Model != nil), nil +} + +func (r SpringCloudAppDynamicsApplicationPerformanceMonitoringResource) template(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-spring-%[2]d" + location = "%[1]s" +} + +resource "azurerm_spring_cloud_service" "test" { + name = "acctest-sc-%[2]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + sku_name = "E0" +} +`, data.Locations.Primary, data.RandomInteger) +} + +func (r SpringCloudAppDynamicsApplicationPerformanceMonitoringResource) basic(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%s + +resource "azurerm_spring_cloud_app_dynamics_application_performance_monitoring" "test" { + name = "acctest-apm-%[2]d" + spring_cloud_service_id = azurerm_spring_cloud_service.test.id + agent_account_name = "test-agent-account-name" + agent_account_access_key = "test-agent-account-access-key" + controller_host_name = "test-controller-host-name" +} +`, template, data.RandomInteger) +} + +func (r SpringCloudAppDynamicsApplicationPerformanceMonitoringResource) requiresImport(data acceptance.TestData) string { + config := r.basic(data) + return fmt.Sprintf(` +%s + +resource "azurerm_spring_cloud_app_dynamics_application_performance_monitoring" "import" { + name = azurerm_spring_cloud_app_dynamics_application_performance_monitoring.test.name + spring_cloud_service_id = azurerm_spring_cloud_app_dynamics_application_performance_monitoring.test.spring_cloud_service_id + agent_account_name = "test-agent-account-name" + agent_account_access_key = "test-agent-account-access-key" + controller_host_name = "test-controller-host-name" +} +`, config) +} + +func (r SpringCloudAppDynamicsApplicationPerformanceMonitoringResource) complete(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%s + +resource "azurerm_spring_cloud_app_dynamics_application_performance_monitoring" "test" { + name = "acctest-apm-%[2]d" + spring_cloud_service_id = azurerm_spring_cloud_service.test.id + agent_account_name = "updated-agent-account-name" + agent_account_access_key = "updated-agent-account-access-key" + controller_host_name = "updated-controller-host-name" + agent_application_name = "test-agent-application-name" + agent_tier_name = "test-agent-tier-name" + agent_node_name = "test-agent-node-name" + agent_unique_host_id = "test-agent-unique-host-id" + controller_ssl_enabled = true + controller_port = 8080 + globally_enabled = true +} +`, template, data.RandomInteger) +} diff --git a/website/docs/r/spring_cloud_app_dynamics_application_performance_monitoring.html.markdown b/website/docs/r/spring_cloud_app_dynamics_application_performance_monitoring.html.markdown new file mode 100644 index 000000000000..f3ba513c3e7f --- /dev/null +++ b/website/docs/r/spring_cloud_app_dynamics_application_performance_monitoring.html.markdown @@ -0,0 +1,101 @@ +--- +subcategory: "Spring Cloud" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_spring_cloud_app_dynamics_application_performance_monitoring" +description: |- + Manages a Spring Cloud Application Performance Monitoring resource for App Dynamics. +--- + +# azurerm_spring_cloud_app_dynamics_application_performance_monitoring + +-> **NOTE:** This resource is only applicable for Spring Cloud Service enterprise tier + +Manages a Spring Cloud Application Performance Monitoring resource for App Dynamics. + +## Example Usage + +```hcl +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "example" { + name = "example" + location = "West Europe" +} + +resource "azurerm_spring_cloud_service" "example" { + name = "example" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name + sku_name = "E0" +} + +resource "azurerm_spring_cloud_app_dynamics_application_performance_monitoring" "example" { + name = "example" + spring_cloud_service_id = azurerm_spring_cloud_service.example.id + agent_account_name = "example-agent-account-name" + agent_account_access_key = "example-agent-account-access-key" + controller_host_name = "example-controller-host-name" + agent_application_name = "example-agent-application-name" + agent_tier_name = "example-agent-tier-name" + agent_node_name = "example-agent-node-name" + agent_unique_host_id = "example-agent-unique-host-id" + controller_ssl_enabled = true + controller_port = 8080 + globally_enabled = true +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `name` - (Required) The name which should be used for this Spring Cloud Application Performance Monitoring resource for App Dynamics. Changing this forces a new resource to be created. + +* `spring_cloud_service_id` - (Required) The ID of the Spring Cloud Service. Changing this forces a new resource to be created. + +* `agent_account_name` - (Required) Specifies the account name of the App Dynamics account. + +* `agent_account_access_key` - (Required) Specifies the account access key used to authenticate with the Controller. + +* `controller_host_name` - (Required) Specifies the hostname or the IP address of the AppDynamics Controller. + +--- + +* `agent_application_name` - (Optional) Specifies the name of the logical business application that this JVM node belongs to. + +* `agent_tier_name` - (Optional) Specifies the name of the tier that this JVM node belongs to. + +* `agent_node_name` - (Optional) Specifies the name of the node. Where JVMs are dynamically created. + +* `agent_unique_host_id` - (Optional) Specifies the unique host ID which is used to Logically partition a single physical host or virtual machine such that it appears to the Controller that the application is running on different machines. + +* `controller_ssl_enabled` - (Optional) Specifies whether enable use SSL (HTTPS) to connect to the AppDynamics Controller. + +* `controller_port` - (Optional) Specifies the HTTP(S) port of the AppDynamics Controller. This is the port used to access the AppDynamics browser-based user interface. + +* `globally_enabled` - (Optional) Specifies whether the Spring Cloud Application Performance Monitoring resource for Application Insights is enabled globally. Defaults to `false`. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Spring Cloud Application Performance Monitoring resource for App Dynamics. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: + +* `create` - (Defaults to 30 minutes) Used when creating the Spring Cloud Application Performance Monitoring resource for App Dynamics. +* `read` - (Defaults to 5 minutes) Used when retrieving the Spring Cloud Application Performance Monitoring resource for App Dynamics. +* `update` - (Defaults to 30 minutes) Used when updating the Spring Cloud Application Performance Monitoring resource for App Dynamics. +* `delete` - (Defaults to 30 minutes) Used when deleting the Spring Cloud Application Performance Monitoring resource for App Dynamics. + +## Import + +Spring Cloud Application Performance Monitoring resource for App Dynamics can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_spring_cloud_app_dynamics_application_performance_monitoring.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.AppPlatform/spring/service1/apms/apm1 +``` From f37d9166529813e14118384315ec1b837a74a71b Mon Sep 17 00:00:00 2001 From: Heng Lu Date: Fri, 2 Feb 2024 10:08:48 +0800 Subject: [PATCH 2/3] update --- internal/services/springcloud/registration.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/services/springcloud/registration.go b/internal/services/springcloud/registration.go index e15d1b25c7a1..144a856161dd 100644 --- a/internal/services/springcloud/registration.go +++ b/internal/services/springcloud/registration.go @@ -69,14 +69,15 @@ func (r Registration) DataSources() []sdk.DataSource { func (r Registration) Resources() []sdk.Resource { return []sdk.Resource{ - SpringCloudDynatraceApplicationPerformanceMonitoringResource{}, - SpringCloudGatewayResource{}, + SpringCloudAppDynamicsApplicationPerformanceMonitoringResource{}, SpringCloudApplicationInsightsApplicationPerformanceMonitoringResource{}, SpringCloudAPIPortalResource{}, SpringCloudAcceleratorResource{}, SpringCloudApplicationLiveViewResource{}, - SpringCloudDevToolPortalResource{}, SpringCloudCustomizedAcceleratorResource{}, + SpringCloudDevToolPortalResource{}, + SpringCloudDynatraceApplicationPerformanceMonitoringResource{}, + SpringCloudGatewayResource{}, SpringCloudElasticApplicationPerformanceMonitoringResource{}, SpringCloudNewRelicApplicationPerformanceMonitoringResource{}, } From 5731a15056d6cecc09eb74dc8098ed93c1581841 Mon Sep 17 00:00:00 2001 From: Heng Lu Date: Fri, 2 Feb 2024 22:06:37 +0800 Subject: [PATCH 3/3] make generate --- .github/labeler-issue-triage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/labeler-issue-triage.yml b/.github/labeler-issue-triage.yml index eb00ea6de95a..5ca64ed228fb 100644 --- a/.github/labeler-issue-triage.yml +++ b/.github/labeler-issue-triage.yml @@ -319,7 +319,7 @@ service/signalr: - '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_(signalr_s|web_pubsub)((.|\n)*)###' service/spring: - - '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_(spring_cloud_accelerator\W+|spring_cloud_active_deployment\W+|spring_cloud_api_portal\W+|spring_cloud_api_portal_custom_domain\W+|spring_cloud_app\W+|spring_cloud_app_cosmosdb_association\W+|spring_cloud_app_mysql_association\W+|spring_cloud_app_redis_association\W+|spring_cloud_application_insights_application_performance_monitoring\W+|spring_cloud_application_live_view\W+|spring_cloud_build_deployment\W+|spring_cloud_build_pack_binding\W+|spring_cloud_builder\W+|spring_cloud_certificate\W+|spring_cloud_configuration_service\W+|spring_cloud_container_deployment\W+|spring_cloud_custom_domain\W+|spring_cloud_customized_accelerator\W+|spring_cloud_dev_tool_portal\W+|spring_cloud_dynatrace_application_performance_monitoring\W+|spring_cloud_elastic_application_performance_monitoring\W+|spring_cloud_gateway\W+|spring_cloud_gateway_custom_domain\W+|spring_cloud_gateway_route_config\W+|spring_cloud_java_deployment\W+|spring_cloud_new_relic_application_performance_monitoring\W+|spring_cloud_service\W+|spring_cloud_storage\W+)((.|\n)*)###' + - '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_(spring_cloud_accelerator\W+|spring_cloud_active_deployment\W+|spring_cloud_api_portal\W+|spring_cloud_api_portal_custom_domain\W+|spring_cloud_app\W+|spring_cloud_app_cosmosdb_association\W+|spring_cloud_app_dynamics_application_performance_monitoring\W+|spring_cloud_app_mysql_association\W+|spring_cloud_app_redis_association\W+|spring_cloud_application_insights_application_performance_monitoring\W+|spring_cloud_application_live_view\W+|spring_cloud_build_deployment\W+|spring_cloud_build_pack_binding\W+|spring_cloud_builder\W+|spring_cloud_certificate\W+|spring_cloud_configuration_service\W+|spring_cloud_container_deployment\W+|spring_cloud_custom_domain\W+|spring_cloud_customized_accelerator\W+|spring_cloud_dev_tool_portal\W+|spring_cloud_dynatrace_application_performance_monitoring\W+|spring_cloud_elastic_application_performance_monitoring\W+|spring_cloud_gateway\W+|spring_cloud_gateway_custom_domain\W+|spring_cloud_gateway_route_config\W+|spring_cloud_java_deployment\W+|spring_cloud_new_relic_application_performance_monitoring\W+|spring_cloud_service\W+|spring_cloud_storage\W+)((.|\n)*)###' service/sql: - '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_sql_((.|\n)*)###'