github.com/kubevela/workflow@v0.6.0/charts/vela-workflow/templates/definitions/apply-terraform-provider.yaml (about) 1 # Code generated by KubeVela templates. DO NOT EDIT. Please edit the original cue file. 2 # Definition source cue file: vela-templates/definitions/internal/apply-terraform-provider.cue 3 apiVersion: core.oam.dev/v1beta1 4 kind: WorkflowStepDefinition 5 metadata: 6 annotations: 7 definition.oam.dev/alias: "" 8 definition.oam.dev/description: Apply terraform provider config 9 definition.oam.dev/example-url: https://raw.githubusercontent.com/kubevela/workflow/main/examples/workflow-run/apply-terraform-resource.yaml 10 name: apply-terraform-provider 11 namespace: {{ include "systemDefinitionNamespace" . }} 12 spec: 13 schematic: 14 cue: 15 template: | 16 import ( 17 "vela/op" 18 "strings" 19 ) 20 21 config: op.#CreateConfig & { 22 name: "\(context.name)-\(context.stepName)" 23 namespace: context.namespace 24 template: "terraform-\(parameter.type)" 25 config: { 26 name: parameter.name 27 if parameter.type == "alibaba" { 28 ALICLOUD_ACCESS_KEY: parameter.accessKey 29 ALICLOUD_SECRET_KEY: parameter.secretKey 30 ALICLOUD_REGION: parameter.region 31 } 32 if parameter.type == "aws" { 33 AWS_ACCESS_KEY_ID: parameter.accessKey 34 AWS_SECRET_ACCESS_KEY: parameter.secretKey 35 AWS_DEFAULT_REGION: parameter.region 36 AWS_SESSION_TOKEN: parameter.token 37 } 38 if parameter.type == "azure" { 39 ARM_CLIENT_ID: parameter.clientID 40 ARM_CLIENT_SECRET: parameter.clientSecret 41 ARM_SUBSCRIPTION_ID: parameter.subscriptionID 42 ARM_TENANT_ID: parameter.tenantID 43 } 44 if parameter.type == "baidu" { 45 BAIDUCLOUD_ACCESS_KEY: parameter.accessKey 46 BAIDUCLOUD_SECRET_KEY: parameter.secretKey 47 BAIDUCLOUD_REGION: parameter.region 48 } 49 if parameter.type == "ec" { 50 EC_API_KEY: parameter.apiKey 51 } 52 if parameter.type == "gcp" { 53 GOOGLE_CREDENTIALS: parameter.credentials 54 GOOGLE_REGION: parameter.region 55 GOOGLE_PROJECT: parameter.project 56 } 57 if parameter.type == "tencent" { 58 TENCENTCLOUD_SECRET_ID: parameter.secretID 59 TENCENTCLOUD_SECRET_KEY: parameter.secretKey 60 TENCENTCLOUD_REGION: parameter.region 61 } 62 if parameter.type == "ucloud" { 63 UCLOUD_PRIVATE_KEY: parameter.privateKey 64 UCLOUD_PUBLIC_KEY: parameter.publicKey 65 UCLOUD_PROJECT_ID: parameter.projectID 66 UCLOUD_REGION: parameter.region 67 } 68 } 69 } 70 read: op.#Read & { 71 value: { 72 apiVersion: "terraform.core.oam.dev/v1beta1" 73 kind: "Provider" 74 metadata: { 75 name: parameter.name 76 namespace: context.namespace 77 } 78 } 79 } 80 check: op.#ConditionalWait & { 81 if read.value.status != _|_ { 82 continue: read.value.status.state == "ready" 83 } 84 if read.value.status == _|_ { 85 continue: false 86 } 87 } 88 providerBasic: { 89 accessKey: string 90 secretKey: string 91 region: string 92 } 93 #AlibabaProvider: { 94 providerBasic 95 type: "alibaba" 96 name: *"alibaba-provider" | string 97 } 98 #AWSProvider: { 99 providerBasic 100 token: *"" | string 101 type: "aws" 102 name: *"aws-provider" | string 103 } 104 #AzureProvider: { 105 subscriptionID: string 106 tenantID: string 107 clientID: string 108 clientSecret: string 109 name: *"azure-provider" | string 110 } 111 #BaiduProvider: { 112 providerBasic 113 type: "baidu" 114 name: *"baidu-provider" | string 115 } 116 #ECProvider: { 117 type: "ec" 118 apiKey: *"" | string 119 name: "ec-provider" | string 120 } 121 #GCPProvider: { 122 credentials: string 123 region: string 124 project: string 125 type: "gcp" 126 name: *"gcp-provider" | string 127 } 128 #TencentProvider: { 129 secretID: string 130 secretKey: string 131 region: string 132 type: "tencent" 133 name: *"tencent-provider" | string 134 } 135 #UCloudProvider: { 136 publicKey: string 137 privateKey: string 138 projectID: string 139 region: string 140 type: "ucloud" 141 name: *"ucloud-provider" | string 142 } 143 parameter: *#AlibabaProvider | #AWSProvider | #AzureProvider | #BaiduProvider | #ECProvider | #GCPProvider | #TencentProvider | #UCloudProvider 144