Skip to content

Commit 78e6b5d

Browse files
committed
implement methods to get terraform scripts from a GIT repo
1 parent 7ed0d2f commit 78e6b5d

File tree

44 files changed

+1183
-278
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1183
-278
lines changed

DEPENDENCIES

+49-46
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
maven/mavencentral/ch.qos.logback/logback-classic/1.4.11, EPL-1.0 OR LGPL-2.1-only, approved, #3435
2-
maven/mavencentral/ch.qos.logback/logback-core/1.4.11, EPL-1.0 OR LGPL-2.1-only, approved, #3373
1+
maven/mavencentral/ch.qos.logback/logback-classic/1.4.14, EPL-1.0 OR LGPL-2.1-only, approved, #3435
2+
maven/mavencentral/ch.qos.logback/logback-core/1.4.14, EPL-1.0 OR LGPL-2.1-only, approved, #3373
33
maven/mavencentral/com.fasterxml.jackson.core/jackson-annotations/2.15.3, Apache-2.0, approved, #7947
44
maven/mavencentral/com.fasterxml.jackson.core/jackson-core/2.15.3, MIT AND Apache-2.0, approved, #7932
55
maven/mavencentral/com.fasterxml.jackson.core/jackson-databind/2.15.3, Apache-2.0, approved, #7934
@@ -9,17 +9,19 @@ maven/mavencentral/com.fasterxml.jackson.datatype/jackson-datatype-jsr310/2.15.3
99
maven/mavencentral/com.fasterxml.jackson.module/jackson-module-parameter-names/2.15.3, Apache-2.0, approved, #8803
1010
maven/mavencentral/com.github.stephenc.jcip/jcip-annotations/1.0-1, Apache-2.0, approved, CQ21949
1111
maven/mavencentral/com.google.code.findbugs/jsr305/3.0.2, Apache-2.0, approved, #20
12+
maven/mavencentral/com.googlecode.javaewah/JavaEWAH/1.2.3, Apache-2.0, approved, clearlydefined
1213
maven/mavencentral/com.jayway.jsonpath/json-path/2.8.0, Apache-2.0, approved, clearlydefined
1314
maven/mavencentral/com.nimbusds/content-type/2.3, Apache-2.0, approved, clearlydefined
1415
maven/mavencentral/com.nimbusds/lang-tag/1.7, Apache-2.0, approved, clearlydefined
1516
maven/mavencentral/com.nimbusds/nimbus-jose-jwt/9.37.3, Apache-2.0, approved, #11701
16-
maven/mavencentral/com.nimbusds/oauth2-oidc-sdk/11.7.1, , restricted, clearlydefined
17-
maven/mavencentral/io.micrometer/micrometer-commons/1.12.0, Apache-2.0 AND (Apache-2.0 AND MIT), approved, #11679
18-
maven/mavencentral/io.micrometer/micrometer-observation/1.12.0, Apache-2.0, approved, #11680
17+
maven/mavencentral/com.nimbusds/oauth2-oidc-sdk/11.9.1, Apache-2.0, approved, #12667
18+
maven/mavencentral/commons-codec/commons-codec/1.16.0, Apache-2.0 AND (Apache-2.0 AND BSD-3-Clause), approved, #9157
19+
maven/mavencentral/io.micrometer/micrometer-commons/1.12.2, Apache-2.0 AND (Apache-2.0 AND MIT), approved, #11679
20+
maven/mavencentral/io.micrometer/micrometer-observation/1.12.2, Apache-2.0, approved, #11680
1921
maven/mavencentral/io.opentelemetry.instrumentation/opentelemetry-instrumentation-annotations/1.32.0, Apache-2.0, approved, #11684
2022
maven/mavencentral/io.opentelemetry.instrumentation/opentelemetry-instrumentation-api-semconv/1.32.0-alpha, Apache-2.0, approved, #11885
2123
maven/mavencentral/io.opentelemetry.instrumentation/opentelemetry-instrumentation-api/1.32.0, Apache-2.0, approved, clearlydefined
22-
maven/mavencentral/io.opentelemetry.instrumentation/opentelemetry-spring-boot-starter/1.32.0-alpha, None, restricted, #11906
24+
maven/mavencentral/io.opentelemetry.instrumentation/opentelemetry-spring-boot-starter/1.32.0-alpha, Apache-2.0, approved, #11906
2325
maven/mavencentral/io.opentelemetry.instrumentation/opentelemetry-spring-boot/1.32.0-alpha, Apache-2.0, approved, #11886
2426
maven/mavencentral/io.opentelemetry.semconv/opentelemetry-semconv/1.21.0-alpha, Apache-2.0, approved, clearlydefined
2527
maven/mavencentral/io.opentelemetry/opentelemetry-api/1.32.0, Apache-2.0, approved, #11682
@@ -44,51 +46,52 @@ maven/mavencentral/net.minidev/json-smart/2.5.0, Apache-2.0, approved, clearlyde
4446
maven/mavencentral/org.apache.commons/commons-lang3/3.13.0, Apache-2.0, approved, #9820
4547
maven/mavencentral/org.apache.logging.log4j/log4j-api/2.21.1, Apache-2.0 AND (Apache-2.0 AND LGPL-2.0-or-later), approved, #11079
4648
maven/mavencentral/org.apache.logging.log4j/log4j-to-slf4j/2.21.1, Apache-2.0, approved, #11919
47-
maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-core/10.1.16, Apache-2.0 AND (EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0) AND (CDDL-1.0 OR GPL-2.0-only WITH Classpath-exception-2.0) AND W3C AND CC0-1.0, approved, #5949
48-
maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-el/10.1.16, Apache-2.0, approved, #6997
49-
maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-websocket/10.1.16, Apache-2.0, approved, #7920
49+
maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-core/10.1.18, Apache-2.0 AND (EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0) AND (CDDL-1.0 OR GPL-2.0-only WITH Classpath-exception-2.0) AND W3C AND CC0-1.0, approved, #5949
50+
maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-el/10.1.18, Apache-2.0, approved, #6997
51+
maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-websocket/10.1.18, Apache-2.0, approved, #7920
5052
maven/mavencentral/org.apiguardian/apiguardian-api/1.1.2, Apache-2.0, approved, clearlydefined
51-
maven/mavencentral/org.aspectj/aspectjweaver/1.9.20.1, Apache-2.0 AND BSD-3-Clause AND EPL-1.0 AND BSD-3-Clause AND Apache-1.1, approved, #7695
53+
maven/mavencentral/org.aspectj/aspectjweaver/1.9.21, Apache-2.0 AND BSD-3-Clause AND EPL-1.0 AND BSD-3-Clause AND Apache-1.1, approved, #7695
54+
maven/mavencentral/org.eclipse.jgit/org.eclipse.jgit/6.8.0.202311291450-r, BSD-3-Clause, approved, technology.jgit
5255
maven/mavencentral/org.ow2.asm/asm/9.3, BSD-3-Clause, approved, clearlydefined
5356
maven/mavencentral/org.projectlombok/lombok/1.18.30, MIT AND LicenseRef-Public-Domain, approved, CQ23907
54-
maven/mavencentral/org.slf4j/jul-to-slf4j/2.0.9, MIT, approved, #7698
55-
maven/mavencentral/org.slf4j/slf4j-api/2.0.9, MIT, approved, #5915
57+
maven/mavencentral/org.slf4j/jul-to-slf4j/2.0.11, MIT, approved, #7698
58+
maven/mavencentral/org.slf4j/slf4j-api/2.0.11, MIT, approved, #5915
5659
maven/mavencentral/org.springdoc/springdoc-openapi-starter-common/2.3.0, Apache-2.0, approved, clearlydefined
5760
maven/mavencentral/org.springdoc/springdoc-openapi-starter-webmvc-api/2.3.0, Apache-2.0, approved, clearlydefined
5861
maven/mavencentral/org.springdoc/springdoc-openapi-starter-webmvc-ui/2.3.0, Apache-2.0, approved, clearlydefined
59-
maven/mavencentral/org.springframework.boot/spring-boot-autoconfigure/3.2.0, Apache-2.0, approved, #11751
60-
maven/mavencentral/org.springframework.boot/spring-boot-starter-aop/3.2.0, Apache-2.0, approved, #11928
61-
maven/mavencentral/org.springframework.boot/spring-boot-starter-json/3.2.0, Apache-2.0, approved, #11894
62-
maven/mavencentral/org.springframework.boot/spring-boot-starter-logging/3.2.0, Apache-2.0, approved, #11890
63-
maven/mavencentral/org.springframework.boot/spring-boot-starter-oauth2-resource-server/3.2.0, Apache-2.0, approved, #11931
64-
maven/mavencentral/org.springframework.boot/spring-boot-starter-security/3.2.0, , restricted, clearlydefined
65-
maven/mavencentral/org.springframework.boot/spring-boot-starter-tomcat/3.2.0, Apache-2.0, approved, #11923
66-
maven/mavencentral/org.springframework.boot/spring-boot-starter-web/3.2.0, Apache-2.0, approved, #11916
67-
maven/mavencentral/org.springframework.boot/spring-boot-starter/3.2.0, Apache-2.0, approved, #11935
68-
maven/mavencentral/org.springframework.boot/spring-boot/3.2.0, Apache-2.0, approved, #11752
69-
maven/mavencentral/org.springframework.security/spring-security-config/6.2.0, Apache-2.0, approved, #11896
70-
maven/mavencentral/org.springframework.security/spring-security-core/6.2.0, Apache-2.0, approved, #11904
71-
maven/mavencentral/org.springframework.security/spring-security-crypto/6.2.0, Apache-2.0 AND ISC, approved, #11908
72-
maven/mavencentral/org.springframework.security/spring-security-oauth2-core/6.2.0, Apache-2.0, approved, #11925
73-
maven/mavencentral/org.springframework.security/spring-security-oauth2-jose/6.2.0, Apache-2.0, approved, #11893
74-
maven/mavencentral/org.springframework.security/spring-security-oauth2-resource-server/6.2.0, Apache-2.0, approved, #11920
75-
maven/mavencentral/org.springframework.security/spring-security-web/6.2.0, Apache-2.0, approved, #11911
76-
maven/mavencentral/org.springframework/spring-aop/6.1.1, Apache-2.0, approved, #11755
77-
maven/mavencentral/org.springframework/spring-beans/6.1.1, Apache-2.0, approved, #11754
78-
maven/mavencentral/org.springframework/spring-context/6.1.1, Apache-2.0, approved, #11753
79-
maven/mavencentral/org.springframework/spring-core/6.1.1, Apache-2.0 AND BSD-3-Clause, approved, #11750
80-
maven/mavencentral/org.springframework/spring-expression/6.1.1, Apache-2.0, approved, #11747
81-
maven/mavencentral/org.springframework/spring-jcl/6.1.1, Apache-2.0, approved, #11749
82-
maven/mavencentral/org.springframework/spring-web/6.1.1, Apache-2.0, approved, #11748
83-
maven/mavencentral/org.springframework/spring-webmvc/6.1.1, Apache-2.0, approved, #11879
84-
maven/mavencentral/org.webjars/swagger-ui/5.10.3, NOASSERTION, restricted, clearlydefined
62+
maven/mavencentral/org.springframework.boot/spring-boot-autoconfigure/3.2.2, Apache-2.0, approved, #11751
63+
maven/mavencentral/org.springframework.boot/spring-boot-starter-aop/3.2.2, Apache-2.0, approved, #11928
64+
maven/mavencentral/org.springframework.boot/spring-boot-starter-json/3.2.2, Apache-2.0, approved, #11894
65+
maven/mavencentral/org.springframework.boot/spring-boot-starter-logging/3.2.2, Apache-2.0, approved, #11890
66+
maven/mavencentral/org.springframework.boot/spring-boot-starter-oauth2-resource-server/3.2.2, Apache-2.0, approved, #11931
67+
maven/mavencentral/org.springframework.boot/spring-boot-starter-security/3.2.2, Apache-2.0, approved, #12069
68+
maven/mavencentral/org.springframework.boot/spring-boot-starter-tomcat/3.2.2, Apache-2.0, approved, #11923
69+
maven/mavencentral/org.springframework.boot/spring-boot-starter-web/3.2.2, Apache-2.0, approved, #11916
70+
maven/mavencentral/org.springframework.boot/spring-boot-starter/3.2.2, Apache-2.0, approved, #11935
71+
maven/mavencentral/org.springframework.boot/spring-boot/3.2.2, Apache-2.0, approved, #11752
72+
maven/mavencentral/org.springframework.security/spring-security-config/6.2.1, Apache-2.0, approved, #11896
73+
maven/mavencentral/org.springframework.security/spring-security-core/6.2.1, Apache-2.0, approved, #11904
74+
maven/mavencentral/org.springframework.security/spring-security-crypto/6.2.1, Apache-2.0 AND ISC, approved, #11908
75+
maven/mavencentral/org.springframework.security/spring-security-oauth2-core/6.2.1, Apache-2.0, approved, #11925
76+
maven/mavencentral/org.springframework.security/spring-security-oauth2-jose/6.2.1, Apache-2.0, approved, #11893
77+
maven/mavencentral/org.springframework.security/spring-security-oauth2-resource-server/6.2.1, Apache-2.0, approved, #11920
78+
maven/mavencentral/org.springframework.security/spring-security-web/6.2.1, Apache-2.0, approved, #11911
79+
maven/mavencentral/org.springframework/spring-aop/6.1.3, Apache-2.0, approved, #11755
80+
maven/mavencentral/org.springframework/spring-beans/6.1.3, Apache-2.0, approved, #11754
81+
maven/mavencentral/org.springframework/spring-context/6.1.3, Apache-2.0, approved, #11753
82+
maven/mavencentral/org.springframework/spring-core/6.1.3, Apache-2.0 AND BSD-3-Clause, approved, #11750
83+
maven/mavencentral/org.springframework/spring-expression/6.1.3, Apache-2.0, approved, #11747
84+
maven/mavencentral/org.springframework/spring-jcl/6.1.3, Apache-2.0, approved, #11749
85+
maven/mavencentral/org.springframework/spring-web/6.1.3, Apache-2.0, approved, #11748
86+
maven/mavencentral/org.springframework/spring-webmvc/6.1.3, Apache-2.0, approved, #11879
87+
maven/mavencentral/org.webjars/swagger-ui/5.10.3, Apache-2.0, approved, #12068
8588
maven/mavencentral/org.yaml/snakeyaml/2.2, Apache-2.0 AND (Apache-2.0 OR BSD-3-Clause OR EPL-1.0 OR GPL-2.0-or-later OR LGPL-2.1-or-later), approved, #10232
8689
maven/mavencentral/org.zalando/faux-pas/0.9.0, MIT, approved, clearlydefined
87-
maven/mavencentral/org.zalando/logbook-api/3.7.1, , restricted, clearlydefined
88-
maven/mavencentral/org.zalando/logbook-common/3.7.1, , restricted, clearlydefined
89-
maven/mavencentral/org.zalando/logbook-core/3.7.1, , restricted, clearlydefined
90-
maven/mavencentral/org.zalando/logbook-json/3.7.1, , restricted, clearlydefined
91-
maven/mavencentral/org.zalando/logbook-servlet/3.7.1, , restricted, clearlydefined
92-
maven/mavencentral/org.zalando/logbook-spring-boot-autoconfigure/3.7.1, , restricted, clearlydefined
93-
maven/mavencentral/org.zalando/logbook-spring-boot-starter/3.7.1, , restricted, clearlydefined
94-
maven/mavencentral/org.zalando/logbook-spring/3.7.1, , restricted, clearlydefined
90+
maven/mavencentral/org.zalando/logbook-api/3.7.2, MIT, approved, #12460
91+
maven/mavencentral/org.zalando/logbook-common/3.7.2, MIT, approved, #12487
92+
maven/mavencentral/org.zalando/logbook-core/3.7.2, MIT, approved, #12060
93+
maven/mavencentral/org.zalando/logbook-json/3.7.2, MIT, approved, #12059
94+
maven/mavencentral/org.zalando/logbook-servlet/3.7.2, MIT, approved, #12458
95+
maven/mavencentral/org.zalando/logbook-spring-boot-autoconfigure/3.7.2, MIT, approved, #12067
96+
maven/mavencentral/org.zalando/logbook-spring-boot-starter/3.7.2, MIT AND Apache-2.0 AND (CC-BY-SA-3.0 AND MIT), approved, #12065
97+
maven/mavencentral/org.zalando/logbook-spring/3.7.2, MIT, approved, #12467

README.md

+18-4
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,16 @@
99

1010
# terraform-boot
1111

12-
A spring-boot-based project which aims to provide a RESTful API for Terraform CLI.
12+
A spring-boot-based project which aims to provide a RESTful API for Terraform CLI. It provides three different modes of
13+
execution
14+
15+
1. Scripts in a directory
16+
2. Scripts in REST request body
17+
3. Scripts in a GIT repo
1318

1419
## Modes of Terraform Script Execution
1520

16-
### Scripts in Directory
21+
### Scripts in a Directory
1722

1823
Pass the terraform root folder name in the request and terraform-boot will execute the requested Terraform method on
1924
this directory.
@@ -30,11 +35,20 @@ The default root folder where all module sub-folders will exist is the **temp**
3035

3136
This configuration can be changed by updating the `terraform.root.module.directory` property.
3237

33-
### Scripts in Request
38+
### Scripts in the Request Body
3439

3540
All files needed for terraform execution can be passed as strings to API and terraform-boot will automatically execute
3641
the files and return terraform execution result.
3742

43+
### Scripts in GIT Repo
44+
45+
If the scripts are present in a GIT repo, then we can directly pass the details of the GIT repo. Terraform-boot will
46+
clone the repo and execute the scripts and then return the result.
47+
48+
> [!NOTE]
49+
> Currently supports only repos that can be cloned without authentication and also with HTTP(S) only.
50+
51+
3852
## Supported API Methods
3953

4054
* deploy - This wraps the Terraform `plan` and `apply` methods.
@@ -63,7 +77,7 @@ The below property names can be changed in the following ways
6377
|------------------------------------|------------------------------------|--------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------|
6478
| terraform_binary_path | TERRAFORM_BINARY_PATH | Terraform available on syspath | The path to the terraform binary |
6579
| terraform.root.module.directory | TERRAFORM_ROOT_MODULE_DIRECTORY | /tmp on Linux<br/>\AppData\Local\Temp on Windows | The path to the parent directory where all terraform module directories will be stored at as subdirs |
66-
| log.terraform.stdout.stderr | LOG_TERRAFORM_STDOUT_STDERR | false | Controls if the command execution output must be logged. If disabled, the output is only returned in the API response |
80+
| log.terraform.stdout.stderr | LOG_TERRAFORM_STDOUT_STDERR | true | Controls if the command execution output must be logged. If disabled, the output is only returned in the API response |
6781
| terraform.log.level | TERRAFORM_LOG_LEVEL | INFO | Controls the log level of the terraform binary. Allowed values are INFO, DEBUG, TRACE, WARN and ERROR |
6882
| authorization.token.type | AUTHORIZATION_TOKEN_TYPE | JWT | Authorization server authentication Type, allowed values: OpaqueToken or JWT |
6983
| authorization.server.endpoint | AUTHORIZATION_SERVER_ENDPOINT | | The endpoint value of the authorization server |

pom.xml

+12-3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@
2727
<lombok.version>1.18.30</lombok.version>
2828
<opentelemetry.version>1.32.0</opentelemetry.version>
2929
<eclipse.dash.tool.plugin>1.1.0</eclipse.dash.tool.plugin>
30+
<jgit.version>6.8.0.202311291450-r</jgit.version>
31+
<maven.complier.plugin.version>3.12.1</maven.complier.plugin.version>
32+
<maven.surefire.plugin.version>3.2.5</maven.surefire.plugin.version>
33+
<maven.enforcer.plugin.version>3.4.1</maven.enforcer.plugin.version>
3034
</properties>
3135
<dependencyManagement>
3236
<dependencies>
@@ -96,6 +100,11 @@
96100
<artifactId>opentelemetry-spring-boot-starter</artifactId>
97101
<version>${opentelemetry.version}-alpha</version>
98102
</dependency>
103+
<dependency>
104+
<groupId>org.eclipse.jgit</groupId>
105+
<artifactId>org.eclipse.jgit</artifactId>
106+
<version>${jgit.version}</version>
107+
</dependency>
99108
</dependencies>
100109

101110
<build>
@@ -114,7 +123,7 @@
114123
<plugin>
115124
<groupId>org.apache.maven.plugins</groupId>
116125
<artifactId>maven-compiler-plugin</artifactId>
117-
<version>3.12.1</version>
126+
<version>${maven.complier.plugin.version}</version>
118127
<configuration>
119128
<source>${java.version}</source>
120129
<target>${java.version}</target>
@@ -123,7 +132,7 @@
123132
<plugin>
124133
<groupId>org.apache.maven.plugins</groupId>
125134
<artifactId>maven-surefire-plugin</artifactId>
126-
<version>3.2.5</version>
135+
<version>${maven.surefire.plugin.version}</version>
127136
</plugin>
128137
<plugin>
129138
<groupId>org.apache.maven.plugins</groupId>
@@ -146,7 +155,7 @@
146155
<plugin>
147156
<groupId>org.apache.maven.plugins</groupId>
148157
<artifactId>maven-enforcer-plugin</artifactId>
149-
<version>3.4.1</version>
158+
<version>${maven.enforcer.plugin.version}</version>
150159
<executions>
151160
<execution>
152161
<id>enforce-versions</id>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* SPDX-License-Identifier: Apache-2.0
3+
* SPDX-FileCopyrightText: Huawei Inc.
4+
*/
5+
6+
package org.eclipse.xpanse.terraform.boot.api.config;
7+
8+
import io.swagger.v3.oas.models.OpenAPI;
9+
import io.swagger.v3.oas.models.info.Info;
10+
import org.springframework.beans.factory.annotation.Value;
11+
import org.springframework.context.annotation.Bean;
12+
import org.springframework.context.annotation.Configuration;
13+
14+
15+
/**
16+
* Configuration springdoc openAPI.
17+
*/
18+
@Configuration
19+
public class SpringDocOpenApiConfig {
20+
21+
@Value("${app.version:1.0.0}")
22+
private String version;
23+
24+
/**
25+
* Configuration openAPI.
26+
*/
27+
@Bean
28+
public OpenAPI configOpenApi() {
29+
return new OpenAPI().info(new Info().title("Terraform-Boot API")
30+
.description("RESTful Services to interact with terraform CLI")
31+
.version(version));
32+
}
33+
}

0 commit comments

Comments
 (0)