ruslan-ikhsan commented on code in PR #25793: URL: https://github.com/apache/beam/pull/25793#discussion_r1177785161
########## learning/tour-of-beam/terraform/build.gradle.kts: ########## @@ -0,0 +1,388 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * License); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import com.pswidersk.gradle.terraform.TerraformTask +import java.io.ByteArrayOutputStream +import java.util.regex.Pattern + +plugins { + id("com.pswidersk.terraform-plugin") version "1.0.0" +} + +terraformPlugin { + terraformVersion.set("1.0.9") +} + +/* init Infrastructure for migrate */ +tasks.register<TerraformTask>("terraformInit") { + // exec args can be passed by commandline, for example + var environment = project.property("project_environment") as String + args( + "init", "-migrate-state", + "-backend-config=./environment/$environment/state.tfbackend", + "-var=environment=$environment", + if (file("./environment/$environment/terraform.tfvars").exists()) { + "-var-file=./environment/$environment/terraform.tfvars" + } else { + "-no-color" + } + ) + } + + /* refresh Infrastucture for remote state */ +tasks.register<TerraformTask>("terraformRef") { + var environment = project.property("project_environment") as String + args( + "refresh", + "-lock=false", + "-var=environment=$environment", + if (file("./environment/$environment/terraform.tfvars").exists()) { + "-var-file=./environment/$environment/terraform.tfvars" + } else { + "-no-color" + } + ) + } + +tasks.register<TerraformTask>("terraformApplyBackend") { + group = "backend-deploy" + var pg_router_host = project.extensions.extraProperties["pg_router_host"] as String + var environment = project.property("project_environment") as String + var gcloud_account = project.property("gcloud_account") as String + args( + "apply", + "-auto-approve", Review Comment: Kotlin Gradle script will no longer be involved into infrastructure creation and configuration -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
