Skip to content

Commit

Permalink
Working commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Will committed Dec 21, 2022
1 parent e6fcc41 commit cd77de6
Show file tree
Hide file tree
Showing 10 changed files with 159 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Code of Conduct

HashiCorp Community Guidelines apply to you when interacting with the community here on GitHub and contributing code.

Please read the full text at https://www.hashicorp.com/community-guidelines
43 changes: 43 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
Hi there,

Thank you for opening an issue. Please note that we try to keep the Terraform issue tracker reserved for bug reports and feature requests. For general usage questions, please see: https://www.terraform.io/community.html.

### Terraform Version
Run `terraform -v` to show the version. If you are not running the latest version of Terraform, please upgrade because your issue may have already been fixed.

### Affected Resource(s)
Please list the resources as a list, for example:
- opc_instance
- opc_storage_volume

If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.

### Terraform Configuration Files
```hcl
# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. For
# security, you can also encrypt the files using our GPG public key.
```

### Debug Output
Please provider a link to a GitHub Gist containing the complete debug output: https://www.terraform.io/docs/internals/debugging.html. Please do NOT paste the debug output in the issue; just paste a link to the Gist.

### Panic Output
If Terraform produced a panic, please provide a link to a GitHub Gist containing the output of the `crash.log`.

### Expected Behavior
What should have happened?

### Actual Behavior
What actually happened?

### Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
1. `terraform apply`

### Important Factoids
Are there anything atypical about your accounts that we should know? For example: Running in EC2 Classic? Custom version of OpenStack? Tight ACLs?

### References
Are there any other GitHub issues (open or closed) or Pull Requests that should be linked here? For example:
- GH-1234
42 changes: 42 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# This GitHub action can publish assets for release when a tag is created.
# Currently its setup to run on any tag that matches the pattern "v*" (ie. v0.1.0).
#
# This uses an action (hashicorp/ghaction-import-gpg) that assumes you set your
# private key in the `GPG_PRIVATE_KEY` secret and passphrase in the `PASSPHRASE`
# secret. If you would rather own your own GPG handling, please fork this action
# or use an alternative one for key handling.
#
# You will need to pass the `--batch` flag to `gpg` in your signing step
# in `goreleaser` to indicate this is being used in a non-interactive mode.
#
name: release
on:
push:
tags:
- "v*"
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Unshallow
run: git fetch --prune --unshallow
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17
- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.HASHICORP_GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.HASHICORP_GPG_PASSPHRASE }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.1
1.0.0
25 changes: 25 additions & 0 deletions docs/data-sources/whatsmyip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "whatsmyip Data Source - whatsmyip"
subcategory: ""
description: |-
---

# whatsmyip (Data Source)





<!-- schema generated by tfplugindocs -->
## Schema

### Read-Only

- `cc` (String)
- `country` (String)
- `id` (String) The ID of this resource.
- `ip` (String)


16 changes: 16 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "whatsmyip Provider"
subcategory: ""
description: |-
---

# whatsmyip Provider





<!-- schema generated by tfplugindocs -->
## Schema
2 changes: 1 addition & 1 deletion examples/main.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
terraform {
required_providers {
whatsmyip = {
versions = "0.0.1"
version = "0.0.1"
source = "hashicorp.com/wdew/whatsmyip"
}
}
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ func main() {
return whatsmyip.Provider()
},
})
}
}
25 changes: 23 additions & 2 deletions whatsmyip/data_source_whatsmyip.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,36 @@ import (
"time"
"encoding/json"

"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

// dataSourceWhatsmyip is where we define the schema of the Terraform data source
func dataSourceWhatsmyip() *schema.Resource {
return &schema.Resource{
Read: whatsmyipRead,
Schema: map[string]*schema.Schema{
"value": {
"id": {
Type: schema.TypeString,
Computed: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
"ip": {
Type: schema.TypeString,
Computed: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
"cc": {
Type: schema.TypeString,
Computed: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
"country": {
Type: schema.TypeString,
Computed: true,
Elem: &schema.Schema{
Expand Down
5 changes: 2 additions & 3 deletions whatsmyip/provider.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package whatsmyip

import (
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/terraform"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

func Provider() terraform.ResourceProvider {
func Provider() *schema.Provider {
return &schema.Provider{
Schema: map[string]*schema.Schema{},
DataSourcesMap: map[string]*schema.Resource{
Expand Down

0 comments on commit cd77de6

Please sign in to comment.