You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
terraform/internal/command/jsonplan/action_invocations.go

35 lines
939 B

// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1
package jsonplan
import (
"github.com/hashicorp/terraform/internal/plans"
)
type ActionInvocation struct {
// Address is the absolute action address
Address string `json:"address,omitempty"`
// ProviderName allows the property "type" to be interpreted unambiguously
// in the unusual situation where a provider offers a type whose
// name does not start with its own name, such as the "googlebeta" provider
// offering "google_compute_instance".
ProviderName string `json:"provider_name,omitempty"`
}
func MarshalActionInvocations(actions []*plans.ActionInvocationInstanceSrc) ([]ActionInvocation, error) {
ret := make([]ActionInvocation, 0, len(actions))
for _, action := range actions {
ai := ActionInvocation{
Address: action.Addr.String(),
ProviderName: action.ProviderAddr.String(),
}
ret = append(ret, ai)
}
return ret, nil
}