Skip to content

Commit 7cc4f1d

Browse files
committed
set unique id for data source city
1 parent 766278f commit 7cc4f1d

File tree

5 files changed

+8
-5
lines changed

5 files changed

+8
-5
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ PROVIDER_NAME=mcbroken
33
PROVIDER_FULL_PATH=$(REGISTRY)/$(NAMESPACE)/$(PROVIDER_NAME)
44
PROVIDER_FULL_NAME=terraform-provider-$(PROVIDER_NAME)
55
PROJECT=$(NAMESPACE)/$(PROVIDER_FULL_NAME)
6-
VERSION=0.1.2
6+
VERSION=0.1.3
77

88
build-mac: PLUGIN_DIR = ~/.terraform.d/plugins/local/provider/$(PROVIDER_NAME)/$(VERSION)/darwin_amd64
99
build-mac:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
![GitHub release (latest by date)](https://img.shields.io/github/v/release/circa10a/terraform-provider-mcbroken?style=plastic)
66
[![Buy Me A Coffee](https://img.shields.io/badge/BuyMeACoffee-Donate-ff813f.svg?logo=CoffeeScript&style=plastic)](https://www.buymeacoffee.com/caleblemoine)
77

8-
Base the count of your infrastucture resources on the national average of broken mcdonald's ice machines or by a city of your choosing. Powered by [Mcbroken](https://mcbroken.com/).
8+
Base the count of your infrastucture resources on the current number of broken mcdonald's ice machines nationally or by a city of your choosing. Powered by [Mcbroken](https://mcbroken.com/).
99

1010
- [terraform-provider-mcbroken](#terraform-provider-mcbroken)
1111
* [Usage](#usage)

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Mcbroken Provider
22

3-
Base the count of your infrastucture resources on the national average of broken mcdonald's ice machines or by a city of your choosing. Powered by [Mcbroken](https://mcbroken.com/).
3+
Base the count of your infrastucture resources on the current number of broken mcdonald's ice machines nationally or by a city of your choosing. Powered by [Mcbroken](https://mcbroken.com/).
44

55
## Example Usage
66

mcbroken/data_source_cities.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ func dataSourceCitiesRead(ctx context.Context, d *schema.ResourceData, m interfa
8181
return diag.FromErr(err)
8282
}
8383

84-
// Always run to give unique id
84+
// Change ID every run to force update
8585
d.SetId(strconv.FormatInt(time.Now().Unix(), 10))
8686

8787
return diags

mcbroken/data_source_city.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ package mcbroken
33
import (
44
"context"
55
"encoding/json"
6+
"fmt"
67
"net/http"
8+
"strconv"
79
"strings"
810
"time"
911

@@ -68,7 +70,8 @@ func dataSourceCityRead(ctx context.Context, d *schema.ResourceData, m interface
6870
}
6971
}
7072

71-
d.SetId(userChosenCity)
73+
// Change ID every run to force update
74+
d.SetId(fmt.Sprintf("%v-%v", userChosenCity, strconv.FormatInt(time.Now().Unix(), 10)))
7275

7376
return diags
7477
}

0 commit comments

Comments
 (0)