Skip to content

Commit

Permalink
- Fix error in tags
Browse files Browse the repository at this point in the history
- Update README.md and doc.md

Signed-off-by: Alejandro JNM <alejandrojnm@gmail.com>
  • Loading branch information
alejandrojnm committed Mar 10, 2020
1 parent e5e45e6 commit 7f7d75d
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,22 @@ $ make testacc TESTARGS='-run=TestAccCivoDomain_Basic'
```

For information about writting acceptance tests, see the main Terraform [contributing guide](https://github.com/hashicorp/terraform/blob/master/.github/CONTRIBUTING.md#writing-acceptance-tests).

Progress
----------------------
-~~Provider~~
-~~Instances~~
-~~Networks~~
-~~Volumes~~
- Regions
- Quotas
- Sizes
- Domain names
- Domain records
- Kubernetes Clusters
- Kubernetes Applications
- Load balancers
- SSH keys
- Snapshots
- Firewalls
- Templates
9 changes: 6 additions & 3 deletions civo/resource_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,14 @@ func resourceInstanceCreate(d *schema.ResourceData, m interface{}) error {
config.SSHKeyID = attr.(string)
}

if attr, ok := d.GetOk("tags"); ok {
//config.Tags = attr.(*schema.Set).List()
config.Tags = attr.([]string)
tfTags := d.Get("tags").(*schema.Set).List()
tags := make([]string, len(tfTags))
for i, tfTag := range tfTags {
tags[i] = tfTag.(string)
}

config.Tags = tags

instance, err := apiClient.CreateInstance(config)
if err != nil {
fmt.Errorf("failed to create instance: %s", err)
Expand Down
1 change: 1 addition & 0 deletions doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ resource "civo_instance" "my-test-instance" {
hostname = "test-terraform"
initial_user = "root"
size = "g2.large"
tags = ["hello", "test"]
# template = "id"
# network_id = civo_network.custom_net.id // this will be calculate automatic
# depends_on = [civo_network.custom_net] // this is to wait for the creation of the network
Expand Down

0 comments on commit 7f7d75d

Please sign in to comment.