Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/resources/mta.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ EOT
- `deploy_url` (String) The URL of the deploy service, if a custom one has been used(should be present in the same landscape). By default 'deploy-service.<system-domain>'
- `extension_descriptors` (Set of String) The paths for the MTA deployment extension files.
- `extension_descriptors_string` (Set of String) The contents of the MTA deployment extension files.
- `modules` (Set of String) Deploy only the modules of the MTA with the specified names. If not specified, all modules are deployed.
- `mtar_path` (String) The local path where the MTA archive is present. Either this attribute or mtar_url need to be set.
- `mtar_url` (String) The remote URL where the MTA archive is present
- `namespace` (String) The namespace of the MTA. Should be of valid host format
Expand Down
4 changes: 4 additions & 0 deletions internal/provider/datasource_mtas_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ type MtaResourceModelPtr struct {
SourceCodeHash *string
DeployStrategy *string
VersionRule *string
Modules *string
}

func hclDataSourceMtas(mdsmp *MtasDataSourceModelPtr) string {
Expand Down Expand Up @@ -107,6 +108,9 @@ func hclResourceMta(mrmp *MtaResourceModelPtr) string {
{{if .VersionRule}}
version_rule = "{{.VersionRule}}"
{{- end -}}
{{if .Modules}}
modules = {{.Modules}}
{{- end -}}
{{if .DeployUrl}}
deploy_url = "{{.DeployUrl}}"
{{- end }}
Expand Down
16 changes: 16 additions & 0 deletions internal/provider/resource_mta.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,14 @@ __Note:__
stringvalidator.OneOf("HIGHER", "SAME_HIGHER", "ALL"),
},
},
"modules": schema.SetAttribute{
MarkdownDescription: "Deploy only the modules of the MTA with the specified names. If not specified, all modules are deployed.",
Optional: true,
ElementType: types.StringType,
Validators: []validator.Set{
setvalidator.SizeAtLeast(1),
},
},
"mta": schema.SingleNestedAttribute{
MarkdownDescription: "contains the details of the MTA object",
Computed: true,
Expand Down Expand Up @@ -395,6 +403,14 @@ func (r *mtaResource) upsert(ctx context.Context, reqPlan *tfsdk.Plan, reqState
operationParams.Parameters["mtaExtDescriptorId"] = extensionDescriptors
}

if !mtarType.Modules.IsNull() {
var modules []string
diags = mtarType.Modules.ElementsAs(ctx, &modules, false)
respDiags.Append(diags...)

operationParams.Parameters["modulesForDeployment"] = strings.Join(modules, ",")
}

//Starting deploy operation
operationId, _, _, err := r.mtaClient.DefaultApi.StartMtaOperation(ctx, spaceGuid, operationParams)
if err != nil {
Expand Down
2 changes: 2 additions & 0 deletions internal/provider/resource_mta_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ func TestMtaResource_Configure(t *testing.T) {
normalDeploy = "deploy"
bgDeploy = "blue-green-deploy"
versionRuleAll = "ALL"
modules = `["my-app"]`
extensionDescriptorsString = `[
<<EOT
_schema-version: 3.3.0
Expand Down Expand Up @@ -129,6 +130,7 @@ EOT
ExtensionDescriptors: strtostrptr(extensionDescriptors),
DeployStrategy: strtostrptr(normalDeploy),
VersionRule: strtostrptr(versionRuleAll),
Modules: strtostrptr(modules),
}),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr(resourceName, "mtar_path", mtarPath2),
Expand Down
1 change: 1 addition & 0 deletions internal/provider/types_mta.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type MtarType struct {
SourceCodeHash types.String `tfsdk:"source_code_hash"`
DeployStrategy types.String `tfsdk:"deploy_strategy"`
VersionRule types.String `tfsdk:"version_rule"`
Modules types.Set `tfsdk:"modules"`
}

type MtasDataSourceType struct {
Expand Down
Loading