github.com/oam-dev/kubevela@v1.9.11/vela-templates/definitions/internal/workflowstep/apply-terraform-config.cue (about)

     1  import (
     2  	"vela/op"
     3  )
     4  
     5  "apply-terraform-config": {
     6  	alias: ""
     7  	attributes: {}
     8  	description: "Apply terraform configuration in the step"
     9  	annotations: {
    10  		"category": "Terraform"
    11  	}
    12  	labels: {}
    13  	type: "workflow-step"
    14  }
    15  
    16  template: {
    17  	apply: op.#Apply & {
    18  		value: {
    19  			apiVersion: "terraform.core.oam.dev/v1beta2"
    20  			kind:       "Configuration"
    21  			metadata: {
    22  				name:      "\(context.name)-\(context.stepName)"
    23  				namespace: context.namespace
    24  			}
    25  			spec: {
    26  				deleteResource: parameter.deleteResource
    27  				variable:       parameter.variable
    28  				forceDelete:    parameter.forceDelete
    29  				if parameter.source.path != _|_ {
    30  					path: parameter.source.path
    31  				}
    32  				if parameter.source.remote != _|_ {
    33  					remote: parameter.source.remote
    34  				}
    35  				if parameter.source.hcl != _|_ {
    36  					hcl: parameter.source.hcl
    37  				}
    38  				if parameter.providerRef != _|_ {
    39  					providerRef: parameter.providerRef
    40  				}
    41  				if parameter.jobEnv != _|_ {
    42  					jobEnv: parameter.jobEnv
    43  				}
    44  				if parameter.writeConnectionSecretToRef != _|_ {
    45  					writeConnectionSecretToRef: parameter.writeConnectionSecretToRef
    46  				}
    47  				if parameter.region != _|_ {
    48  					region: parameter.region
    49  				}
    50  			}
    51  		}
    52  	}
    53  	check: op.#ConditionalWait & {
    54  		continue: apply.value.status != _|_ && apply.value.status.apply != _|_ && apply.value.status.apply.state == "Available"
    55  	}
    56  	parameter: {
    57  		// +usage=specify the source of the terraform configuration
    58  		source: close({
    59  			// +usage=directly specify the hcl of the terraform configuration
    60  			hcl: string
    61  		}) | close({
    62  			// +usage=specify the remote url of the terraform configuration
    63  			remote: *"https://github.com/kubevela-contrib/terraform-modules.git" | string
    64  			// +usage=specify the path of the terraform configuration
    65  			path?: string
    66  		})
    67  		// +usage=whether to delete resource
    68  		deleteResource: *true | bool
    69  		// +usage=the variable in the configuration
    70  		variable: {...}
    71  		// +usage=this specifies the namespace and name of a secret to which any connection details for this managed resource should be written.
    72  		writeConnectionSecretToRef?: {
    73  			name:      string
    74  			namespace: *context.namespace | string
    75  		}
    76  		// +usage=providerRef specifies the reference to Provider
    77  		providerRef?: {
    78  			name:      string
    79  			namespace: *context.namespace | string
    80  		}
    81  		// +usage=region is cloud provider's region. It will override the region in the region field of providerRef
    82  		region?: string
    83  		// +usage=the envs for job
    84  		jobEnv?: {...}
    85  		// +usage=forceDelete will force delete Configuration no matter which state it is or whether it has provisioned some resources
    86  		forceDelete: *false | bool
    87  	}
    88  }