Skip to content

Commit fefcc62

Browse files
feat: Add ability to set GitHub app as source for git dependency resources
1 parent da674d0 commit fefcc62

8 files changed

Lines changed: 37 additions & 21 deletions

File tree

docs/resources/process_child_step.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ Optional:
133133

134134
- `file_path_filters` (Set of String) List of file path filters used to narrow down the directory where files are to be sourced from. Supports glob patten syntax.
135135
- `git_credential_id` (String) ID of an existing Git credential.
136+
- `github_connection_id` (String) ID of an existing GitHub App connection. Used when git_credential_type is GitHub
136137

137138

138139
<a id="nestedatt--packages"></a>

docs/resources/process_step.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ Optional:
164164

165165
- `file_path_filters` (Set of String) List of file path filters used to narrow down the directory where files are to be sourced from. Supports glob patten syntax.
166166
- `git_credential_id` (String) ID of an existing Git credential.
167+
- `github_connection_id` (String) ID of an existing GitHub App connection. Used when git_credential_type is GitHub
167168

168169

169170
<a id="nestedatt--packages"></a>

docs/resources/process_templated_child_step.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ Optional:
184184

185185
- `file_path_filters` (Set of String) List of file path filters used to narrow down the directory where files are to be sourced from. Supports glob patten syntax.
186186
- `git_credential_id` (String) ID of an existing Git credential.
187+
- `github_connection_id` (String) ID of an existing GitHub App connection. Used when git_credential_type is GitHub
187188

188189

189190
<a id="nestedatt--packages"></a>

docs/resources/process_templated_step.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ Optional:
165165

166166
- `file_path_filters` (Set of String) List of file path filters used to narrow down the directory where files are to be sourced from. Supports glob patten syntax.
167167
- `git_credential_id` (String) ID of an existing Git credential.
168+
- `github_connection_id` (String) ID of an existing GitHub App connection. Used when git_credential_type is GitHub
168169

169170

170171
<a id="nestedatt--packages"></a>

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.24.0
55
toolchain go1.24.5
66

77
require (
8-
github.com/OctopusDeploy/go-octopusdeploy/v2 v2.95.0
8+
github.com/OctopusDeploy/go-octopusdeploy/v2 v2.96.0
99
github.com/OctopusSolutionsEngineering/OctopusTerraformTestFramework v1.0.2
1010
github.com/google/uuid v1.6.0
1111
github.com/hashicorp/go-cty v1.4.1-0.20200723130312-85980079f637

go.sum

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ github.com/OctopusDeploy/go-octodiff v1.0.0 h1:U+ORg6azniwwYo+O44giOw6TiD5USk8S4
2121
github.com/OctopusDeploy/go-octodiff v1.0.0/go.mod h1:Mze0+EkOWTgTmi8++fyUc6r0aLZT7qD9gX+31t8MmIU=
2222
github.com/OctopusDeploy/go-octopusdeploy/v2 v2.95.0 h1:zSrcA1jVi9vKz786rhJxi8EDyN+6YEPyLncOebk+yMQ=
2323
github.com/OctopusDeploy/go-octopusdeploy/v2 v2.95.0/go.mod h1:VkTXDoIPbwGFi5+goo1VSwFNdMVo784cVtJdKIEvfus=
24+
github.com/OctopusDeploy/go-octopusdeploy/v2 v2.95.1-0.20251211021954-20cad2b7a2d0 h1:UNcHBCthgIjxdjphwm0R688AdAMmHuXpsE3Pkl1fmx4=
25+
github.com/OctopusDeploy/go-octopusdeploy/v2 v2.95.1-0.20251211021954-20cad2b7a2d0/go.mod h1:VkTXDoIPbwGFi5+goo1VSwFNdMVo784cVtJdKIEvfus=
26+
github.com/OctopusDeploy/go-octopusdeploy/v2 v2.96.0 h1:MLVK95s2+qf2IPginWLB13KKQsXIApD5zuyXZJRiDaI=
27+
github.com/OctopusDeploy/go-octopusdeploy/v2 v2.96.0/go.mod h1:VkTXDoIPbwGFi5+goo1VSwFNdMVo784cVtJdKIEvfus=
2428
github.com/OctopusSolutionsEngineering/OctopusTerraformTestFramework v1.0.2 h1:960T/UryMsoc2ZOnoLEg7rM9QpxWIdkdB9sR5gsUFAQ=
2529
github.com/OctopusSolutionsEngineering/OctopusTerraformTestFramework v1.0.2/go.mod h1:kllISYzQ8N3P6+3rScVhyW/KWnPWQbwzm8pFcMInSRM=
2630
github.com/ProtonMail/go-crypto v1.1.6 h1:ZcV+Ropw6Qn0AX9brlQLAUXfqLBc7Bl+f/DmNxpLfdw=

octopusdeploy_framework/resource_process_step.go

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -351,11 +351,12 @@ func mapProcessStepActionGitDependenciesFromState(ctx context.Context, dependenc
351351
}
352352

353353
gitDependency := &gitdependencies.GitDependency{
354-
Name: key,
355-
RepositoryUri: dependencyState.RepositoryUri.ValueString(),
356-
DefaultBranch: dependencyState.DefaultBranch.ValueString(),
357-
GitCredentialType: dependencyState.GitCredentialType.ValueString(),
358-
GitCredentialId: dependencyState.GitCredentialID.ValueString(),
354+
Name: key,
355+
RepositoryUri: dependencyState.RepositoryUri.ValueString(),
356+
DefaultBranch: dependencyState.DefaultBranch.ValueString(),
357+
GitCredentialType: dependencyState.GitCredentialType.ValueString(),
358+
GitCredentialId: dependencyState.GitCredentialID.ValueString(),
359+
GitHubConnectionId: dependencyState.GitHubConnectionID.ValueString(),
359360
}
360361

361362
if dependencyState.FilePathFilters.IsNull() {
@@ -541,11 +542,12 @@ func mapGitDependenciesToState(dependencies []*gitdependencies.GitDependency) ty
541542
stateDependency := types.ObjectValueMust(
542543
schemas.ProcessStepGitDependencyAttributeTypes(),
543544
map[string]attr.Value{
544-
"repository_uri": types.StringValue(dependency.RepositoryUri),
545-
"default_branch": types.StringValue(dependency.DefaultBranch),
546-
"git_credential_type": types.StringValue(dependency.GitCredentialType),
547-
"file_path_filters": types.SetValueMust(types.StringType, util.ToValueSlice(dependency.FilePathFilters)),
548-
"git_credential_id": types.StringValue(dependency.GitCredentialId),
545+
"repository_uri": types.StringValue(dependency.RepositoryUri),
546+
"default_branch": types.StringValue(dependency.DefaultBranch),
547+
"git_credential_type": types.StringValue(dependency.GitCredentialType),
548+
"file_path_filters": types.SetValueMust(types.StringType, util.ToValueSlice(dependency.FilePathFilters)),
549+
"git_credential_id": types.StringValue(dependency.GitCredentialId),
550+
"github_connection_id": types.StringValue(dependency.GitHubConnectionId),
549551
},
550552
)
551553

octopusdeploy_framework/schemas/process_step.go

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -289,11 +289,12 @@ func resourceActionPackageReferenceAttributes() map[string]resourceSchema.Attrib
289289
}
290290

291291
type ProcessStepGitDependencyResourceModel struct {
292-
RepositoryUri types.String `tfsdk:"repository_uri"`
293-
DefaultBranch types.String `tfsdk:"default_branch"`
294-
GitCredentialType types.String `tfsdk:"git_credential_type"`
295-
FilePathFilters types.Set `tfsdk:"file_path_filters"`
296-
GitCredentialID types.String `tfsdk:"git_credential_id"`
292+
RepositoryUri types.String `tfsdk:"repository_uri"`
293+
DefaultBranch types.String `tfsdk:"default_branch"`
294+
GitCredentialType types.String `tfsdk:"git_credential_type"`
295+
FilePathFilters types.Set `tfsdk:"file_path_filters"`
296+
GitCredentialID types.String `tfsdk:"git_credential_id"`
297+
GitHubConnectionID types.String `tfsdk:"github_connection_id"`
297298
}
298299

299300
func ProcessStepGitDependencyObjectType() types.ObjectType {
@@ -304,11 +305,12 @@ func ProcessStepGitDependencyObjectType() types.ObjectType {
304305

305306
func ProcessStepGitDependencyAttributeTypes() map[string]attr.Type {
306307
return map[string]attr.Type{
307-
"repository_uri": types.StringType,
308-
"default_branch": types.StringType,
309-
"git_credential_type": types.StringType,
310-
"file_path_filters": types.SetType{ElemType: types.StringType},
311-
"git_credential_id": types.StringType,
308+
"repository_uri": types.StringType,
309+
"default_branch": types.StringType,
310+
"git_credential_type": types.StringType,
311+
"file_path_filters": types.SetType{ElemType: types.StringType},
312+
"git_credential_id": types.StringType,
313+
"github_connection_id": types.StringType,
312314
}
313315
}
314316

@@ -349,6 +351,10 @@ func resourceActionGitDependencyNestedAttribute() resourceSchema.NestedAttribute
349351
Computed().
350352
Default("").
351353
Build(),
354+
"github_connection_id": util.ResourceString().
355+
Description("ID of an existing GitHub App connection. Used when git_credential_type is GitHub").
356+
Optional().
357+
Build(),
352358
},
353359
}
354360
}

0 commit comments

Comments
 (0)