Skip to content

Commit

Permalink
feat: added ip addresses to agent data source (#150)
Browse files Browse the repository at this point in the history
feat: added ip addresses to agent data source (#150)
  • Loading branch information
joaomper-TE authored Dec 7, 2023
1 parent 476591d commit 3351439
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 2 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,9 @@ Follow the instructions to [install it as a plugin](https://developer.hashicorp.
## Maintainers
This provider plugin is maintained by the ThousandEyes engineering team and accepts community contributions.

> [!NOTE]
> The `docs/` folder should not be changed manually. Instead, if there are changes to the examples, inputs/outputs of any `data_source` or `resource`, you need to run `go generate` locally and commit the resulting changes to the `.md` files.

## Acknowledgements
ThousandEyes would like to thank William Fleming, John Dyer, and Joshua Blanchard for their contribution and community maintenance of this project.
2 changes: 1 addition & 1 deletion docs/data-sources/account_group.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ resource "thousandeyes_http_server" "thousandeyes_http_test" {
}
agents {
agent_id = 3 # Singapur
agent_id = 3 # Singapore
}
}
```
Expand Down
1 change: 1 addition & 0 deletions docs/data-sources/agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,6 @@ resource "thousandeyes_http_server" "www_thousandeyes_http_test" {

- `agent_id` (Number) The unique ID of the agent.
- `id` (String) The ID of this resource.
- `ip_addresses` (List of String) The array of IP Addresses entries for the agent.


Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ resource "thousandeyes_http_server" "thousandeyes_http_test" {
}

agents {
agent_id = 3 # Singapur
agent_id = 3 # Singapore
}
}
10 changes: 10 additions & 0 deletions thousandeyes/data_source_thousandeyes_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ func dataSourceThousandeyesAgent() *schema.Resource {
Computed: true,
Description: "The unique ID of the agent.",
},
"ip_addresses": {
Type: schema.TypeList,
Elem: &schema.Schema{Type: schema.TypeString},
Computed: true,
Description: "The array of IP Addresses entries for the agent.",
},
},
Description: "This data source allows you to define a ThousandEyes agent. For more information, see [Global Vantage Points](https://docs.thousandeyes.com/product-documentation/global-vantage-points).",
}
Expand Down Expand Up @@ -63,6 +69,10 @@ func dataSourceThousandeyesAgentRead(d *schema.ResourceData, meta interface{}) e
if err != nil {
return err
}
err = d.Set("ip_addresses", found.IPAddresses)
if err != nil {
return err
}

return nil
}

0 comments on commit 3351439

Please sign in to comment.