Skip to content
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

Feat: add token_name as a field for data env0_template #903

Merged
merged 2 commits into from
Jul 26, 2024
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 client/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ type Template struct {
HelmChartName string `json:"helmChartName" tfschema:",omitempty"`
IsGitLab bool `json:"isGitLab" tfschema:"is_gitlab"`
TerragruntTfBinary string `json:"terragruntTfBinary" tfschema:",omitempty"`
TokenName string `json:"tokenName"`
}

type TemplateCreatePayload struct {
Expand Down
20 changes: 9 additions & 11 deletions env0/data_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ func dataTemplate() *schema.Resource {
"github_installation_id": {
Type: schema.TypeInt,
Description: "The env0 application installation id on the relevant github repository",
Optional: true,
Computed: true,
},
"token_id": {
Type: schema.TypeString,
Description: "The token id used for private git repos or for integration with GitLab",
Optional: true,
Computed: true,
},
"terraform_version": {
Type: schema.TypeString,
Expand All @@ -100,58 +100,56 @@ func dataTemplate() *schema.Resource {
Type: schema.TypeString,
Description: "terragrunt version to use",
Computed: true,
Optional: true,
},
"is_gitlab_enterprise": {
Type: schema.TypeBool,
Description: "Does this template use gitlab enterprise repository?",
Optional: true,
Computed: true,
},
"bitbucket_client_key": {
Type: schema.TypeString,
Description: "the bitbucket client key used for integration",
Optional: true,
Computed: true,
},
"is_bitbucket_server": {
Type: schema.TypeBool,
Description: "true if this template uses bitbucket server repository",
Optional: true,
Computed: true,
},
"is_github_enterprise": {
Type: schema.TypeBool,
Description: "true if this template uses github enterprise repository",
Optional: true,
Computed: true,
},
"is_azure_devops": {
Type: schema.TypeBool,
Description: "true if this template integrates with azure dev ops",
Optional: true,
Computed: true,
},
"ssh_keys": {
Type: schema.TypeList,
Description: "an array of references to 'data_ssh_key' to use when accessing git over ssh",
Optional: true,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"id": {
Type: schema.TypeString,
Description: "ssh key id",
Required: true,
Computed: true,
},
"name": {
Type: schema.TypeString,
Description: "ssh key name",
Required: true,
Computed: true,
},
},
},
},
"token_name": {
Type: schema.TypeString,
Description: "the token name used for integration with GitLab",
Computed: true,
},
},
}
}
Expand Down
2 changes: 2 additions & 0 deletions env0/data_template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ func TestUnitTemplateData(t *testing.T) {
},
IsBitbucketServer: true,
IsAzureDevOps: true,
TokenName: "tokenname",
}

getValidTestCase := func(input map[string]interface{}) resource.TestCase {
Expand Down Expand Up @@ -69,6 +70,7 @@ func TestUnitTemplateData(t *testing.T) {
resource.TestCheckResourceAttr(resourceFullName, "ssh_keys.0.name", template.SshKeys[0].Name),
resource.TestCheckResourceAttr(resourceFullName, "is_bitbucket_server", "true"),
resource.TestCheckResourceAttr(resourceFullName, "is_azure_devops", "true"),
resource.TestCheckResourceAttr(resourceFullName, "token_name", template.TokenName),
),
},
},
Expand Down
Loading