-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DATAGO-64296: initial commit for terraform plugin #132
Conversation
…each request requires a new client
@@ -0,0 +1,28 @@ | |||
package com.solace.maas.ep.event.management.agent.command.rest; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code will be removed once the messaging I/F is added.
sendLogsAsync(event, | ||
event.getMDCPropertyMap().get(RouteConstants.SCAN_ID), | ||
event.getMDCPropertyMap().get(RouteConstants.TRACE_ID), | ||
event.getMDCPropertyMap().get(RouteConstants.ACTOR_ID), | ||
event.getMDCPropertyMap().get(RouteConstants.SCAN_TYPE), | ||
event.getMDCPropertyMap().get(RouteConstants.SCHEDULE_ID), | ||
event.getMDCPropertyMap().get(RouteConstants.MESSAGING_SERVICE_ID)); | ||
} else if (StringUtils.isNotEmpty(event.getMDCPropertyMap().get(RouteConstants.COMMAND_CORRELATION_ID))) { | ||
log.trace("This is a placeholder for DATAGO-64298"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the hook where we will add the terraform logs in the future.
@@ -3,7 +3,9 @@ | |||
public enum MOPProtocol { | |||
scanData(2850), | |||
scanDataControl(2851), | |||
EMAHeartbeat(2852); | |||
EMAHeartbeat(2852), | |||
commandProtocol(2853); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was added for future considerations when we add the messaging API
@@ -237,22 +239,6 @@ | |||
</resources> | |||
</configuration> | |||
</execution> | |||
<execution> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused execution
@@ -0,0 +1,149 @@ | |||
package com.solace.maas.ep.event.management.agent.plugin.terraform.client; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file comes from open-source with light modifications.
@@ -0,0 +1,197 @@ | |||
package com.solace.maas.ep.event.management.agent.plugin.terraform.client; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file comes from open source with moderate modifications.
@Service | ||
@Data | ||
public class TerraformProperties { | ||
@Value("${plugins.terraform.workingDirectoryRoot:/${HOME}/tfconfig}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an unorthodox way of setting properties. @value is not the recommended way to populate config. In this case I wanted a convenient way to set a default value for this value without requiring a change to the application.yml file. Alternatively, we could add a backend story to EP to create a new plugins.terraform.workingDirectoryRoot
property to the generated application.ylm file.
service/application/src/main/java/com/solace/maas/ep/common/messages/CommandMessage.java
Outdated
Show resolved
Hide resolved
.../main/java/com/solace/maas/ep/event/management/agent/plugin/command/model/CommandBundle.java
Outdated
Show resolved
Hide resolved
.../java/com/solace/maas/ep/event/management/agent/plugin/terraform/client/TerraformClient.java
Outdated
Show resolved
Hide resolved
...e/maas/ep/event/management/agent/plugin/terraform/manager/TerraformLogProcessingService.java
Outdated
Show resolved
Hide resolved
...e/maas/ep/event/management/agent/plugin/terraform/manager/TerraformLogProcessingService.java
Outdated
Show resolved
Hide resolved
...e/maas/ep/event/management/agent/plugin/terraform/manager/TerraformLogProcessingService.java
Show resolved
Hide resolved
...e/maas/ep/event/management/agent/plugin/terraform/manager/TerraformLogProcessingService.java
Outdated
Show resolved
Hide resolved
String traceId = MDC.get("traceId"); | ||
String spanId = MDC.get("spanId"); | ||
|
||
log.debug("Executing command {} for ms {} correlationId {} context {}", command.getCommand(), request.getServiceId(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please change ms
to some generic name like service
since it won't work for schemaRegsitry configPush scenarios
What is the purpose of this change?
This PR adds the new terraform plugin to the EMA. The plugin is added as a new module.
Additionally, a temporary REST API has been added to allow testing
The REST API follows the newly approved command model
How was this change implemented?
The terraformClient has been copied and modified from https://github.com/microsoft/terraform-spring-boot
The RESP API is added to the
application
module since this module takes care of the northbound interfaceThe terraform specific code is added to the
terraform-plugin
module.Some work has been deferred to later stories such as:
How was this change tested?
TerraformClientRealTests
test class in the terraform-pluginIs there anything the reviewers should focus on/be aware of?
Just re-iterating, some of the code was taken from open-source (MIT license) at https://github.com/microsoft/terraform-spring-boot
The following classes were copied and modified:
ProcessLauncher
TerraformClient
Our lawyer gave the thumbs up to use this code as long as we include a link to it's origin and a copy of the license under which it was released.