Skip to content

Commit

Permalink
Merge pull request #78 from swaroopar/feature/GitRepo
Browse files Browse the repository at this point in the history
Feature/git repo
  • Loading branch information
iskey authored Jan 30, 2024
2 parents 7ed0d2f + 78e6b5d commit 975e5bd
Show file tree
Hide file tree
Showing 44 changed files with 1,183 additions and 278 deletions.
95 changes: 49 additions & 46 deletions DEPENDENCIES
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
maven/mavencentral/ch.qos.logback/logback-classic/1.4.11, EPL-1.0 OR LGPL-2.1-only, approved, #3435
maven/mavencentral/ch.qos.logback/logback-core/1.4.11, EPL-1.0 OR LGPL-2.1-only, approved, #3373
maven/mavencentral/ch.qos.logback/logback-classic/1.4.14, EPL-1.0 OR LGPL-2.1-only, approved, #3435
maven/mavencentral/ch.qos.logback/logback-core/1.4.14, EPL-1.0 OR LGPL-2.1-only, approved, #3373
maven/mavencentral/com.fasterxml.jackson.core/jackson-annotations/2.15.3, Apache-2.0, approved, #7947
maven/mavencentral/com.fasterxml.jackson.core/jackson-core/2.15.3, MIT AND Apache-2.0, approved, #7932
maven/mavencentral/com.fasterxml.jackson.core/jackson-databind/2.15.3, Apache-2.0, approved, #7934
Expand All @@ -9,17 +9,19 @@ maven/mavencentral/com.fasterxml.jackson.datatype/jackson-datatype-jsr310/2.15.3
maven/mavencentral/com.fasterxml.jackson.module/jackson-module-parameter-names/2.15.3, Apache-2.0, approved, #8803
maven/mavencentral/com.github.stephenc.jcip/jcip-annotations/1.0-1, Apache-2.0, approved, CQ21949
maven/mavencentral/com.google.code.findbugs/jsr305/3.0.2, Apache-2.0, approved, #20
maven/mavencentral/com.googlecode.javaewah/JavaEWAH/1.2.3, Apache-2.0, approved, clearlydefined
maven/mavencentral/com.jayway.jsonpath/json-path/2.8.0, Apache-2.0, approved, clearlydefined
maven/mavencentral/com.nimbusds/content-type/2.3, Apache-2.0, approved, clearlydefined
maven/mavencentral/com.nimbusds/lang-tag/1.7, Apache-2.0, approved, clearlydefined
maven/mavencentral/com.nimbusds/nimbus-jose-jwt/9.37.3, Apache-2.0, approved, #11701
maven/mavencentral/com.nimbusds/oauth2-oidc-sdk/11.7.1, , restricted, clearlydefined
maven/mavencentral/io.micrometer/micrometer-commons/1.12.0, Apache-2.0 AND (Apache-2.0 AND MIT), approved, #11679
maven/mavencentral/io.micrometer/micrometer-observation/1.12.0, Apache-2.0, approved, #11680
maven/mavencentral/com.nimbusds/oauth2-oidc-sdk/11.9.1, Apache-2.0, approved, #12667
maven/mavencentral/commons-codec/commons-codec/1.16.0, Apache-2.0 AND (Apache-2.0 AND BSD-3-Clause), approved, #9157
maven/mavencentral/io.micrometer/micrometer-commons/1.12.2, Apache-2.0 AND (Apache-2.0 AND MIT), approved, #11679
maven/mavencentral/io.micrometer/micrometer-observation/1.12.2, Apache-2.0, approved, #11680
maven/mavencentral/io.opentelemetry.instrumentation/opentelemetry-instrumentation-annotations/1.32.0, Apache-2.0, approved, #11684
maven/mavencentral/io.opentelemetry.instrumentation/opentelemetry-instrumentation-api-semconv/1.32.0-alpha, Apache-2.0, approved, #11885
maven/mavencentral/io.opentelemetry.instrumentation/opentelemetry-instrumentation-api/1.32.0, Apache-2.0, approved, clearlydefined
maven/mavencentral/io.opentelemetry.instrumentation/opentelemetry-spring-boot-starter/1.32.0-alpha, None, restricted, #11906
maven/mavencentral/io.opentelemetry.instrumentation/opentelemetry-spring-boot-starter/1.32.0-alpha, Apache-2.0, approved, #11906
maven/mavencentral/io.opentelemetry.instrumentation/opentelemetry-spring-boot/1.32.0-alpha, Apache-2.0, approved, #11886
maven/mavencentral/io.opentelemetry.semconv/opentelemetry-semconv/1.21.0-alpha, Apache-2.0, approved, clearlydefined
maven/mavencentral/io.opentelemetry/opentelemetry-api/1.32.0, Apache-2.0, approved, #11682
Expand All @@ -44,51 +46,52 @@ maven/mavencentral/net.minidev/json-smart/2.5.0, Apache-2.0, approved, clearlyde
maven/mavencentral/org.apache.commons/commons-lang3/3.13.0, Apache-2.0, approved, #9820
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
maven/mavencentral/org.apache.logging.log4j/log4j-to-slf4j/2.21.1, Apache-2.0, approved, #11919
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
maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-el/10.1.16, Apache-2.0, approved, #6997
maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-websocket/10.1.16, Apache-2.0, approved, #7920
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
maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-el/10.1.18, Apache-2.0, approved, #6997
maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-websocket/10.1.18, Apache-2.0, approved, #7920
maven/mavencentral/org.apiguardian/apiguardian-api/1.1.2, Apache-2.0, approved, clearlydefined
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
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
maven/mavencentral/org.eclipse.jgit/org.eclipse.jgit/6.8.0.202311291450-r, BSD-3-Clause, approved, technology.jgit
maven/mavencentral/org.ow2.asm/asm/9.3, BSD-3-Clause, approved, clearlydefined
maven/mavencentral/org.projectlombok/lombok/1.18.30, MIT AND LicenseRef-Public-Domain, approved, CQ23907
maven/mavencentral/org.slf4j/jul-to-slf4j/2.0.9, MIT, approved, #7698
maven/mavencentral/org.slf4j/slf4j-api/2.0.9, MIT, approved, #5915
maven/mavencentral/org.slf4j/jul-to-slf4j/2.0.11, MIT, approved, #7698
maven/mavencentral/org.slf4j/slf4j-api/2.0.11, MIT, approved, #5915
maven/mavencentral/org.springdoc/springdoc-openapi-starter-common/2.3.0, Apache-2.0, approved, clearlydefined
maven/mavencentral/org.springdoc/springdoc-openapi-starter-webmvc-api/2.3.0, Apache-2.0, approved, clearlydefined
maven/mavencentral/org.springdoc/springdoc-openapi-starter-webmvc-ui/2.3.0, Apache-2.0, approved, clearlydefined
maven/mavencentral/org.springframework.boot/spring-boot-autoconfigure/3.2.0, Apache-2.0, approved, #11751
maven/mavencentral/org.springframework.boot/spring-boot-starter-aop/3.2.0, Apache-2.0, approved, #11928
maven/mavencentral/org.springframework.boot/spring-boot-starter-json/3.2.0, Apache-2.0, approved, #11894
maven/mavencentral/org.springframework.boot/spring-boot-starter-logging/3.2.0, Apache-2.0, approved, #11890
maven/mavencentral/org.springframework.boot/spring-boot-starter-oauth2-resource-server/3.2.0, Apache-2.0, approved, #11931
maven/mavencentral/org.springframework.boot/spring-boot-starter-security/3.2.0, , restricted, clearlydefined
maven/mavencentral/org.springframework.boot/spring-boot-starter-tomcat/3.2.0, Apache-2.0, approved, #11923
maven/mavencentral/org.springframework.boot/spring-boot-starter-web/3.2.0, Apache-2.0, approved, #11916
maven/mavencentral/org.springframework.boot/spring-boot-starter/3.2.0, Apache-2.0, approved, #11935
maven/mavencentral/org.springframework.boot/spring-boot/3.2.0, Apache-2.0, approved, #11752
maven/mavencentral/org.springframework.security/spring-security-config/6.2.0, Apache-2.0, approved, #11896
maven/mavencentral/org.springframework.security/spring-security-core/6.2.0, Apache-2.0, approved, #11904
maven/mavencentral/org.springframework.security/spring-security-crypto/6.2.0, Apache-2.0 AND ISC, approved, #11908
maven/mavencentral/org.springframework.security/spring-security-oauth2-core/6.2.0, Apache-2.0, approved, #11925
maven/mavencentral/org.springframework.security/spring-security-oauth2-jose/6.2.0, Apache-2.0, approved, #11893
maven/mavencentral/org.springframework.security/spring-security-oauth2-resource-server/6.2.0, Apache-2.0, approved, #11920
maven/mavencentral/org.springframework.security/spring-security-web/6.2.0, Apache-2.0, approved, #11911
maven/mavencentral/org.springframework/spring-aop/6.1.1, Apache-2.0, approved, #11755
maven/mavencentral/org.springframework/spring-beans/6.1.1, Apache-2.0, approved, #11754
maven/mavencentral/org.springframework/spring-context/6.1.1, Apache-2.0, approved, #11753
maven/mavencentral/org.springframework/spring-core/6.1.1, Apache-2.0 AND BSD-3-Clause, approved, #11750
maven/mavencentral/org.springframework/spring-expression/6.1.1, Apache-2.0, approved, #11747
maven/mavencentral/org.springframework/spring-jcl/6.1.1, Apache-2.0, approved, #11749
maven/mavencentral/org.springframework/spring-web/6.1.1, Apache-2.0, approved, #11748
maven/mavencentral/org.springframework/spring-webmvc/6.1.1, Apache-2.0, approved, #11879
maven/mavencentral/org.webjars/swagger-ui/5.10.3, NOASSERTION, restricted, clearlydefined
maven/mavencentral/org.springframework.boot/spring-boot-autoconfigure/3.2.2, Apache-2.0, approved, #11751
maven/mavencentral/org.springframework.boot/spring-boot-starter-aop/3.2.2, Apache-2.0, approved, #11928
maven/mavencentral/org.springframework.boot/spring-boot-starter-json/3.2.2, Apache-2.0, approved, #11894
maven/mavencentral/org.springframework.boot/spring-boot-starter-logging/3.2.2, Apache-2.0, approved, #11890
maven/mavencentral/org.springframework.boot/spring-boot-starter-oauth2-resource-server/3.2.2, Apache-2.0, approved, #11931
maven/mavencentral/org.springframework.boot/spring-boot-starter-security/3.2.2, Apache-2.0, approved, #12069
maven/mavencentral/org.springframework.boot/spring-boot-starter-tomcat/3.2.2, Apache-2.0, approved, #11923
maven/mavencentral/org.springframework.boot/spring-boot-starter-web/3.2.2, Apache-2.0, approved, #11916
maven/mavencentral/org.springframework.boot/spring-boot-starter/3.2.2, Apache-2.0, approved, #11935
maven/mavencentral/org.springframework.boot/spring-boot/3.2.2, Apache-2.0, approved, #11752
maven/mavencentral/org.springframework.security/spring-security-config/6.2.1, Apache-2.0, approved, #11896
maven/mavencentral/org.springframework.security/spring-security-core/6.2.1, Apache-2.0, approved, #11904
maven/mavencentral/org.springframework.security/spring-security-crypto/6.2.1, Apache-2.0 AND ISC, approved, #11908
maven/mavencentral/org.springframework.security/spring-security-oauth2-core/6.2.1, Apache-2.0, approved, #11925
maven/mavencentral/org.springframework.security/spring-security-oauth2-jose/6.2.1, Apache-2.0, approved, #11893
maven/mavencentral/org.springframework.security/spring-security-oauth2-resource-server/6.2.1, Apache-2.0, approved, #11920
maven/mavencentral/org.springframework.security/spring-security-web/6.2.1, Apache-2.0, approved, #11911
maven/mavencentral/org.springframework/spring-aop/6.1.3, Apache-2.0, approved, #11755
maven/mavencentral/org.springframework/spring-beans/6.1.3, Apache-2.0, approved, #11754
maven/mavencentral/org.springframework/spring-context/6.1.3, Apache-2.0, approved, #11753
maven/mavencentral/org.springframework/spring-core/6.1.3, Apache-2.0 AND BSD-3-Clause, approved, #11750
maven/mavencentral/org.springframework/spring-expression/6.1.3, Apache-2.0, approved, #11747
maven/mavencentral/org.springframework/spring-jcl/6.1.3, Apache-2.0, approved, #11749
maven/mavencentral/org.springframework/spring-web/6.1.3, Apache-2.0, approved, #11748
maven/mavencentral/org.springframework/spring-webmvc/6.1.3, Apache-2.0, approved, #11879
maven/mavencentral/org.webjars/swagger-ui/5.10.3, Apache-2.0, approved, #12068
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
maven/mavencentral/org.zalando/faux-pas/0.9.0, MIT, approved, clearlydefined
maven/mavencentral/org.zalando/logbook-api/3.7.1, , restricted, clearlydefined
maven/mavencentral/org.zalando/logbook-common/3.7.1, , restricted, clearlydefined
maven/mavencentral/org.zalando/logbook-core/3.7.1, , restricted, clearlydefined
maven/mavencentral/org.zalando/logbook-json/3.7.1, , restricted, clearlydefined
maven/mavencentral/org.zalando/logbook-servlet/3.7.1, , restricted, clearlydefined
maven/mavencentral/org.zalando/logbook-spring-boot-autoconfigure/3.7.1, , restricted, clearlydefined
maven/mavencentral/org.zalando/logbook-spring-boot-starter/3.7.1, , restricted, clearlydefined
maven/mavencentral/org.zalando/logbook-spring/3.7.1, , restricted, clearlydefined
maven/mavencentral/org.zalando/logbook-api/3.7.2, MIT, approved, #12460
maven/mavencentral/org.zalando/logbook-common/3.7.2, MIT, approved, #12487
maven/mavencentral/org.zalando/logbook-core/3.7.2, MIT, approved, #12060
maven/mavencentral/org.zalando/logbook-json/3.7.2, MIT, approved, #12059
maven/mavencentral/org.zalando/logbook-servlet/3.7.2, MIT, approved, #12458
maven/mavencentral/org.zalando/logbook-spring-boot-autoconfigure/3.7.2, MIT, approved, #12067
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
maven/mavencentral/org.zalando/logbook-spring/3.7.2, MIT, approved, #12467
22 changes: 18 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,16 @@

# terraform-boot

A spring-boot-based project which aims to provide a RESTful API for Terraform CLI.
A spring-boot-based project which aims to provide a RESTful API for Terraform CLI. It provides three different modes of
execution

1. Scripts in a directory
2. Scripts in REST request body
3. Scripts in a GIT repo

## Modes of Terraform Script Execution

### Scripts in Directory
### Scripts in a Directory

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

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

### Scripts in Request
### Scripts in the Request Body

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

### Scripts in GIT Repo

If the scripts are present in a GIT repo, then we can directly pass the details of the GIT repo. Terraform-boot will
clone the repo and execute the scripts and then return the result.

> [!NOTE]
> Currently supports only repos that can be cloned without authentication and also with HTTP(S) only.

## Supported API Methods

* deploy - This wraps the Terraform `plan` and `apply` methods.
Expand Down Expand Up @@ -63,7 +77,7 @@ The below property names can be changed in the following ways
|------------------------------------|------------------------------------|--------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------|
| terraform_binary_path | TERRAFORM_BINARY_PATH | Terraform available on syspath | The path to the terraform binary |
| 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 |
| 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 |
| 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 |
| terraform.log.level | TERRAFORM_LOG_LEVEL | INFO | Controls the log level of the terraform binary. Allowed values are INFO, DEBUG, TRACE, WARN and ERROR |
| authorization.token.type | AUTHORIZATION_TOKEN_TYPE | JWT | Authorization server authentication Type, allowed values: OpaqueToken or JWT |
| authorization.server.endpoint | AUTHORIZATION_SERVER_ENDPOINT | | The endpoint value of the authorization server |
Expand Down
15 changes: 12 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
<lombok.version>1.18.30</lombok.version>
<opentelemetry.version>1.32.0</opentelemetry.version>
<eclipse.dash.tool.plugin>1.1.0</eclipse.dash.tool.plugin>
<jgit.version>6.8.0.202311291450-r</jgit.version>
<maven.complier.plugin.version>3.12.1</maven.complier.plugin.version>
<maven.surefire.plugin.version>3.2.5</maven.surefire.plugin.version>
<maven.enforcer.plugin.version>3.4.1</maven.enforcer.plugin.version>
</properties>
<dependencyManagement>
<dependencies>
Expand Down Expand Up @@ -96,6 +100,11 @@
<artifactId>opentelemetry-spring-boot-starter</artifactId>
<version>${opentelemetry.version}-alpha</version>
</dependency>
<dependency>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit</artifactId>
<version>${jgit.version}</version>
</dependency>
</dependencies>

<build>
Expand All @@ -114,7 +123,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.12.1</version>
<version>${maven.complier.plugin.version}</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
Expand All @@ -123,7 +132,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.5</version>
<version>${maven.surefire.plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand All @@ -146,7 +155,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.4.1</version>
<version>${maven.enforcer.plugin.version}</version>
<executions>
<execution>
<id>enforce-versions</id>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* SPDX-License-Identifier: Apache-2.0
* SPDX-FileCopyrightText: Huawei Inc.
*/

package org.eclipse.xpanse.terraform.boot.api.config;

import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


/**
* Configuration springdoc openAPI.
*/
@Configuration
public class SpringDocOpenApiConfig {

@Value("${app.version:1.0.0}")
private String version;

/**
* Configuration openAPI.
*/
@Bean
public OpenAPI configOpenApi() {
return new OpenAPI().info(new Info().title("Terraform-Boot API")
.description("RESTful Services to interact with terraform CLI")
.version(version));
}
}
Loading

0 comments on commit 975e5bd

Please sign in to comment.