This repository was archived by the owner on Jul 22, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 66
adding tags to be returned as part of the tag_set data call #570
Open
garkenxian
wants to merge
2
commits into
OctopusDeployLabs:main
Choose a base branch
from
kennethgarza:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| { | ||
| "name": "golang build env", | ||
| "dockerComposeFile" : [ | ||
| "docker-compose.yml" | ||
| ], | ||
| "service" : "dev_env", | ||
| "workspaceFolder": "/src", | ||
| "forwardPorts": [ | ||
| 0 | ||
| ], | ||
| "extensions": [ | ||
| "ms-azuretools.vscode-docker" | ||
| ] | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| version: "3.8" | ||
| name: terraform-provider-octopusdeploy | ||
| services: | ||
|
|
||
| sql_server: | ||
| image: mcr.microsoft.com/mssql/server:2022-latest | ||
| environment: | ||
| ACCEPT_EULA: Y | ||
| MSSQL_SA_PASSWORD: MyVeryStrongPassword123! | ||
| healthcheck: | ||
| test: [ "CMD", "/opt/mssql-tools/bin/sqlcmd", "-U", "sa", "-P", "MyVeryStrongPassword123!", "-Q", "select 1"] | ||
| interval: 10s | ||
| retries: 10 | ||
| ports: | ||
| - 8433:1433 | ||
|
|
||
| octopus: | ||
| depends_on: | ||
| sql_server: | ||
| condition: service_healthy | ||
| image: octopusdeploy/octopusdeploy | ||
| environment: | ||
| ACCEPT_EULA: "Y" | ||
| ADMIN_USERNAME: admin | ||
| ADMIN_PASSWORD: "P@ssw0rd!" | ||
| ADMIN_API_KEY: API-L2GV2ELTCZDRANT1OQO045GPZHXFGWR | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you copied this API key from a "real" octopus server you may want to revoke the key given its now appeared publicly |
||
| DB_CONNECTION_STRING: Server=sql_server;Database=octopus;User Id=sa;Password=MyVeryStrongPassword123! | ||
| ports: | ||
| - 8080:8080 | ||
|
|
||
| dev_env: | ||
| depends_on: | ||
| sql_server: | ||
| condition: service_healthy | ||
| octopus: | ||
| condition: service_started | ||
| build: | ||
| context: . | ||
| dockerfile: dockerfile | ||
| command: sleep infinity | ||
| volumes: | ||
| - ../:/src | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| FROM hashicorp/terraform | ||
|
|
||
| COPY --from=golang /usr/local/go /usr/local/go | ||
| ENV PATH="/usr/local/go/bin:${PATH}" | ||
|
|
||
| RUN apk add --no-cache make | ||
|
|
||
| ENTRYPOINT [ ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,19 +28,41 @@ func expandTagSet(d *schema.ResourceData) *tagsets.TagSet { | |
| return tagSet | ||
| } | ||
|
|
||
| func flattenTag(tag *tagsets.Tag) map[string]interface{} { | ||
| if tag == nil { | ||
| return nil | ||
| } | ||
|
|
||
| return map[string]interface{}{ | ||
| "canonical_tag_name": tag.CanonicalTagName, | ||
| "color": tag.Color, | ||
| "description": tag.Description, | ||
| "name": tag.Name, | ||
| "sort_order": tag.SortOrder, | ||
| } | ||
|
|
||
| } | ||
|
|
||
| func flattenTagSet(tagSet *tagsets.TagSet) map[string]interface{} { | ||
| if tagSet == nil { | ||
| return nil | ||
| } | ||
|
|
||
| flattened_tags := []interface{}{} | ||
|
|
||
| for _, tag := range tagSet.Tags { | ||
| flattened_tags = append(flattened_tags, flattenTag(tag)) | ||
| } | ||
|
|
||
| return map[string]interface{}{ | ||
| "description": tagSet.Description, | ||
| "id": tagSet.GetID(), | ||
| "name": tagSet.Name, | ||
| "sort_order": tagSet.SortOrder, | ||
| "space_id": tagSet.SpaceID, | ||
| } | ||
| } | ||
| "tags": flattened_tags, | ||
| }} | ||
|
|
||
|
|
||
| func getTagSetDataSchema() map[string]*schema.Schema { | ||
| dataSchema := getTagSetSchema() | ||
|
|
@@ -62,13 +84,44 @@ func getTagSetDataSchema() map[string]*schema.Schema { | |
| } | ||
| } | ||
|
|
||
| func getTagSchemaForTagSet() map[string]*schema.Schema { | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the |
||
| return map[string]*schema.Schema{ | ||
| "canonical_tag_name": { | ||
| Computed: true, | ||
| Type: schema.TypeString, | ||
| }, | ||
| "color": { | ||
| Required: true, | ||
| Type: schema.TypeString, | ||
| }, | ||
| "description": getDescriptionSchema("tag"), | ||
| "name": getNameSchema(true), | ||
| "sort_order": { | ||
| Computed: true, | ||
| Optional: true, | ||
| Type: schema.TypeInt, | ||
| }, | ||
| } | ||
| } | ||
|
|
||
| func getTagSetSchema() map[string]*schema.Schema { | ||
| tagSchema := getTagSchemaForTagSet() | ||
| setDataSchema(&tagSchema) | ||
|
|
||
|
|
||
| return map[string]*schema.Schema{ | ||
| "description": getDescriptionSchema("tag set"), | ||
| "id": getIDSchema(), | ||
| "name": getNameSchema(true), | ||
| "sort_order": getSortOrderSchema(), | ||
| "space_id": getSpaceIDSchema(), | ||
| "tags": { | ||
| Computed: true, | ||
| Description: "A list of tags within the tagset", | ||
| Elem: &schema.Resource{Schema: tagSchema}, | ||
| Optional: true, | ||
| Type: schema.TypeList, | ||
| }, | ||
| } | ||
| } | ||
|
|
||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Looks like these
devcontainerfiles were added to the commit, you may want to update the.gitignore