github.com/opentofu/opentofu@v1.7.1/internal/plans/action.go (about)

     1  // Copyright (c) The OpenTofu Authors
     2  // SPDX-License-Identifier: MPL-2.0
     3  // Copyright (c) 2023 HashiCorp, Inc.
     4  // SPDX-License-Identifier: MPL-2.0
     5  
     6  package plans
     7  
     8  type Action rune
     9  
    10  const (
    11  	NoOp             Action = 0
    12  	Create           Action = '+'
    13  	Read             Action = '←'
    14  	Update           Action = '~'
    15  	DeleteThenCreate Action = '∓'
    16  	CreateThenDelete Action = '±'
    17  	Delete           Action = '-'
    18  	Forget           Action = '.'
    19  )
    20  
    21  //go:generate go run golang.org/x/tools/cmd/stringer -type Action
    22  
    23  // IsReplace returns true if the action is one of the two actions that
    24  // represents replacing an existing object with a new object:
    25  // DeleteThenCreate or CreateThenDelete.
    26  func (a Action) IsReplace() bool {
    27  	return a == DeleteThenCreate || a == CreateThenDelete
    28  }