-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #112 from signalsciences/edge-deployment
add edge deployment provider resources
- Loading branch information
Showing
10 changed files
with
206 additions
and
14 deletions.
There are no files selected for viewing
This file contains 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,32 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "sigsci_edge_deployment Resource - terraform-provider-sigsci" | ||
subcategory: "" | ||
description: |- | ||
--- | ||
|
||
# sigsci_edge_deployment (Resource) | ||
|
||
|
||
|
||
## Example Usage | ||
|
||
```terraform | ||
resource "sigsci_edge_deployment" { | ||
site_short_name = "manual_test" | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `site_short_name` (String) Site short name | ||
|
||
### Read-Only | ||
|
||
- `id` (String) The ID of this resource. | ||
|
||
|
This file contains 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,34 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "sigsci_edge_deployment_service Resource - terraform-provider-sigsci" | ||
subcategory: "" | ||
description: |- | ||
--- | ||
|
||
# sigsci_edge_deployment_service (Resource) | ||
|
||
|
||
|
||
## Example Usage | ||
|
||
```terraform | ||
resource "sigsci_edge_deployment_service" "my-service" { | ||
site_short_name = "manual_test" | ||
fastly_sid = "test_sid" | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `fastly_sid` (String) Fastly service ID | ||
- `site_short_name` (String) Site short name | ||
|
||
### Read-Only | ||
|
||
- `id` (String) The ID of this resource. | ||
|
||
|
This file contains 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,3 @@ | ||
resource "sigsci_edge_deployment" { | ||
site_short_name = "manual_test" | ||
} |
4 changes: 4 additions & 0 deletions
4
examples/resources/sigsci_edge_deployment_service/resource.tf
This file contains 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,4 @@ | ||
resource "sigsci_edge_deployment_service" "my-service" { | ||
site_short_name = "manual_test" | ||
fastly_sid = "test_sid" | ||
} |
This file contains 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 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 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 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 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,40 @@ | ||
package provider | ||
|
||
import ( | ||
"github.com/hashicorp/terraform-plugin-sdk/helper/schema" | ||
) | ||
|
||
func resourceEdgeDeployment() *schema.Resource { | ||
return &schema.Resource{ | ||
Create: createOrUpdateEdgeDeployment, | ||
Read: readEdgeDeployment, | ||
Update: createOrUpdateEdgeDeployment, | ||
Delete: deleteEdgeDeployment, | ||
Importer: &schema.ResourceImporter{}, | ||
Schema: map[string]*schema.Schema{ | ||
"site_short_name": { | ||
Type: schema.TypeString, | ||
Description: "Site short name", | ||
Required: true, | ||
}, | ||
}, | ||
} | ||
} | ||
|
||
func createOrUpdateEdgeDeployment(d *schema.ResourceData, m interface{}) error { | ||
pm := m.(providerMetadata) | ||
|
||
d.SetId(d.Get("site_short_name").(string)) | ||
|
||
return pm.Client.CreateOrUpdateEdgeDeployment(pm.Corp, d.Get("site_short_name").(string)) | ||
} | ||
|
||
func readEdgeDeployment(d *schema.ResourceData, m interface{}) error { | ||
return nil | ||
} | ||
|
||
func deleteEdgeDeployment(d *schema.ResourceData, m interface{}) error { | ||
pm := m.(providerMetadata) | ||
|
||
return pm.Client.DeleteEdgeDeployment(pm.Corp, d.Get("site_short_name").(string)) | ||
} |
This file contains 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,52 @@ | ||
package provider | ||
|
||
import ( | ||
"github.com/hashicorp/terraform-plugin-sdk/helper/schema" | ||
) | ||
|
||
func resourceEdgeDeploymentService() *schema.Resource { | ||
return &schema.Resource{ | ||
Create: createOrUpdateEdgeDeploymentService, | ||
Read: readEdgeDeploymentService, | ||
Update: updateEdgeDeploymentBackends, | ||
Delete: detachEdgeDeploymentService, | ||
Importer: &schema.ResourceImporter{}, | ||
Schema: map[string]*schema.Schema{ | ||
"site_short_name": { | ||
Type: schema.TypeString, | ||
Description: "Site short name", | ||
Required: true, | ||
}, | ||
|
||
"fastly_sid": { | ||
Type: schema.TypeString, | ||
Description: "Fastly service ID", | ||
Required: true, | ||
}, | ||
}, | ||
} | ||
} | ||
|
||
func createOrUpdateEdgeDeploymentService(d *schema.ResourceData, m interface{}) error { | ||
pm := m.(providerMetadata) | ||
|
||
d.SetId(d.Get("fastly_sid").(string)) | ||
|
||
return pm.Client.CreateOrUpdateEdgeDeploymentService(pm.Corp, d.Get("site_short_name").(string), d.Get("fastly_sid").(string)) | ||
} | ||
|
||
func readEdgeDeploymentService(d *schema.ResourceData, m interface{}) error { | ||
return nil | ||
} | ||
|
||
func updateEdgeDeploymentBackends(d *schema.ResourceData, m interface{}) error { | ||
pm := m.(providerMetadata) | ||
|
||
return pm.Client.CreateOrUpdateEdgeDeploymentService(pm.Corp, d.Get("site_short_name").(string), d.Get("fastly_sid").(string)) | ||
} | ||
|
||
func detachEdgeDeploymentService(d *schema.ResourceData, m interface{}) error { | ||
pm := m.(providerMetadata) | ||
|
||
return pm.Client.DetachEdgeDeploymentService(pm.Corp, d.Get("site_short_name").(string), d.Get("fastly_sid").(string)) | ||
} |