Skip to content

Commit

Permalink
fix(#24)!: renames provider and resources to appdynamics
Browse files Browse the repository at this point in the history
closes #24 
MR  (#25)
  • Loading branch information
HarryEMartland authored Aug 7, 2020
1 parent 4826c77 commit 360c478
Show file tree
Hide file tree
Showing 20 changed files with 100 additions and 102 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ jobs:
run: make build

- name: Zip (Mac)
run: zip terraform-provider-appd.zip ./terraform-provider-appd
run: zip terraform-provider-appdynamics.zip ./terraform-provider-appdynamics

- uses: actions/upload-artifact@v2
with:
name: terraform-provider-appd.zip
path: terraform-provider-appd.zip
name: terraform-provider-appdynamics.zip
path: terraform-provider-appdynamics.zip
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ fabric.properties

.terraform

terraform-provider-appd
terraform-provider-appdynamics

*.tf
*.tfstate
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## AppD Terraform Provider
## AppDynamics Terraform Provider

A Terraform Provider for AppDynamics.
Provides resources for creating Health Rules, Actions and configuring Transaction detection through Terraform.
Expand All @@ -7,27 +7,27 @@ Provides resources for creating Health Rules, Actions and configuring Transactio

Download the latest version of the provider and place it where terraform will find it e.g. `~/.terraform.d/plugins/`.
See the [terraform documentation](https://www.terraform.io/docs/extend/how-terraform-works.html#discovery) for more information.
The latest downloads can be found in the [Terraform Registry](https://registry.terraform.io/providers/HarryEMartland/appdynamics/latest) and attached to the [latest release](https://github.com/HarryEMartland/appd-terraform-provider/releases/latest).
The latest downloads can be found in the [Terraform Registry](https://registry.terraform.io/providers/HarryEMartland/appdynamics/latest) and attached to the [latest release](https://github.com/HarryEMartland/terraform-provider-appdynamics/releases/latest).
Make sure to download the correct version for your OS.

#### Configuration

To use the AppD Terraform provider you must configure it with the controller base url and a secret.
A secret can be generated in the AppD UI as documented [here](https://docs.appdynamics.com/display/PRO45/API+Clients).
To use the AppDynamics Terraform provider you must configure it with the controller base url and a secret.
A secret can be generated in the AppDynamics UI as documented [here](https://docs.appdynamics.com/display/PRO45/API+Clients).

###### Example
```terraform
provider "appd" {
provider "appdynamics" {
secret = "<your secret>"
controller_base_url = "https://example.saas.appdynamics.com"
}
```

#### Resources

- [appd_action](docs/resources/action.md)
- [appd_policy](docs/resources/policy.md)
- [appd_health_rule](docs/resources/health_rule.md)
- [appdynamics_action](docs/resources/action.md)
- [appdynamics_policy](docs/resources/policy.md)
- [appdynamics_health_rule](docs/resources/health_rule.md)

#### Building

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions appd/provider.go → appdynamics/provider.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package appd
package appdynamics

import (
"github.com/HarryEMartland/appd-terraform-provider/appd/client"
"github.com/HarryEMartland/terraform-provider-appdynamics/appdynamics/client"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
)

func Provider() *schema.Provider {
return &schema.Provider{
ResourcesMap: map[string]*schema.Resource{
"appd_health_rule": resourceHealthRule(),
"appd_action": resourceAction(),
"appd_policy": resourcePolicy(),
"appdynamics_health_rule": resourceHealthRule(),
"appdynamics_action": resourceAction(),
"appdynamics_policy": resourcePolicy(),
},
Schema: map[string]*schema.Schema{
"secret": {Type: schema.TypeString, Sensitive: true, Required: true},
Expand Down
4 changes: 2 additions & 2 deletions appd/resource_action.go → appdynamics/resource_action.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package appd
package appdynamics

import (
"github.com/HarryEMartland/appd-terraform-provider/appd/client"
"github.com/HarryEMartland/terraform-provider-appdynamics/appdynamics/client"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"strconv"
"strings"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package appd
package appdynamics

import (
"fmt"
Expand All @@ -15,10 +15,10 @@ func TestAccAppDAction_basicSMS(t *testing.T) {

phoneNumber := acctest.RandStringFromCharSet(11, "0123456789")

resourceName := "appd_action.test_sms"
resourceName := "appdynamics_action.test_sms"
resource.Test(t, resource.TestCase{
Providers: map[string]terraform.ResourceProvider{
"appd": Provider(),
"appdynamics": Provider(),
},
Steps: []resource.TestStep{
{
Expand All @@ -41,10 +41,10 @@ func TestAccAppDAction_updateSMS(t *testing.T) {
phoneNumber1 := acctest.RandStringFromCharSet(11, "0123456789")
phoneNumber2 := acctest.RandStringFromCharSet(11, "0123456789")

resourceName := "appd_action.test_sms"
resourceName := "appdynamics_action.test_sms"
resource.Test(t, resource.TestCase{
Providers: map[string]terraform.ResourceProvider{
"appd": Provider(),
"appdynamics": Provider(),
},
Steps: []resource.TestStep{
{
Expand Down Expand Up @@ -77,10 +77,10 @@ func TestAccAppDAction_basicEmail(t *testing.T) {
email := fmt.Sprintf("%s@example.com", acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum))
emails := []string{email}

resourceName := "appd_action.test_email"
resourceName := "appdynamics_action.test_email"
resource.Test(t, resource.TestCase{
Providers: map[string]terraform.ResourceProvider{
"appd": Provider(),
"appdynamics": Provider(),
},
Steps: []resource.TestStep{
{
Expand All @@ -106,10 +106,10 @@ func TestAccAppDAction_updateEmail(t *testing.T) {
emails := []string{email}
emailsUpdated := []string{email, email2}

resourceName := "appd_action.test_email"
resourceName := "appdynamics_action.test_email"
resource.Test(t, resource.TestCase{
Providers: map[string]terraform.ResourceProvider{
"appd": Provider(),
"appdynamics": Provider(),
},
Steps: []resource.TestStep{
{
Expand Down Expand Up @@ -143,19 +143,18 @@ func TestAccAppDAction_updateEmail(t *testing.T) {
func TestAccAppDAction_basicHttp(t *testing.T) {

name := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum)
templateName := os.Getenv("APPD_HTTP_ACTION_TEMPLATE_NAME")

resourceName := "appd_action.test_http_action"
resourceName := "appdynamics_action.test_http_action"
resource.Test(t, resource.TestCase{
Providers: map[string]terraform.ResourceProvider{
"appd": Provider(),
"appdynamics": Provider(),
},
Steps: []resource.TestStep{
{
Config: httpAction(name, templateName, map[string]string{"config": "cValue"}),
Config: httpAction(name, httpActionTemplateName, map[string]string{"config": "cValue"}),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr(resourceName, "name", name),
resource.TestCheckResourceAttr(resourceName, "http_request_template_name", templateName),
resource.TestCheckResourceAttr(resourceName, "http_request_template_name", httpActionTemplateName),
resource.TestCheckResourceAttr(resourceName, "action_type", "HTTP_REQUEST"),
resource.TestCheckResourceAttr(resourceName, "custom_template_variables.config", "cValue"),
CheckActionExists(resourceName),
Expand All @@ -170,29 +169,28 @@ func TestAccAppDAction_updateHttp(t *testing.T) {

name := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum)
updateName := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum)
templateName := os.Getenv("APPD_HTTP_ACTION_TEMPLATE_NAME")

resourceName := "appd_action.test_http_action"
resourceName := "appdynamics_action.test_http_action"
resource.Test(t, resource.TestCase{
Providers: map[string]terraform.ResourceProvider{
"appd": Provider(),
"appdynamics": Provider(),
},
Steps: []resource.TestStep{
{
Config: httpAction(name, templateName, map[string]string{"config": "cValue"}),
Config: httpAction(name, httpActionTemplateName, map[string]string{"config": "cValue"}),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr(resourceName, "name", name),
resource.TestCheckResourceAttr(resourceName, "http_request_template_name", templateName),
resource.TestCheckResourceAttr(resourceName, "http_request_template_name", httpActionTemplateName),
resource.TestCheckResourceAttr(resourceName, "action_type", "HTTP_REQUEST"),
resource.TestCheckResourceAttr(resourceName, "custom_template_variables.config", "cValue"),
CheckActionExists(resourceName),
),
},
{
Config: httpAction(updateName, templateName, map[string]string{"config": "cValue", "second": "sValue"}),
Config: httpAction(updateName, httpActionTemplateName, map[string]string{"config": "cValue", "second": "sValue"}),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr(resourceName, "name", updateName),
resource.TestCheckResourceAttr(resourceName, "http_request_template_name", templateName),
resource.TestCheckResourceAttr(resourceName, "http_request_template_name", httpActionTemplateName),
resource.TestCheckResourceAttr(resourceName, "action_type", "HTTP_REQUEST"),
resource.TestCheckResourceAttr(resourceName, "custom_template_variables.config", "cValue"),
resource.TestCheckResourceAttr(resourceName, "custom_template_variables.second", "sValue"),
Expand Down Expand Up @@ -251,7 +249,7 @@ func CheckActionExists(resourceName string) func(state *terraform.State) error {
func smsAction(phoneNumber string) string {
return fmt.Sprintf(`
%s
resource "appd_action" "test_sms" {
resource "appdynamics_action" "test_sms" {
application_id = var.application_id
action_type = "SMS"
phone_number = "%s"
Expand All @@ -262,7 +260,7 @@ func smsAction(phoneNumber string) string {
func emailAction(emails []string) string {
return fmt.Sprintf(`
%s
resource "appd_action" "test_email" {
resource "appdynamics_action" "test_email" {
application_id = var.application_id
action_type = "EMAIL"
emails = ["%s"]
Expand All @@ -273,7 +271,7 @@ func emailAction(emails []string) string {
func httpAction(name string, templateName string, variableMap map[string]string) string {
return fmt.Sprintf(`
%s
resource "appd_action" "test_http_action" {
resource "appdynamics_action" "test_http_action" {
application_id = var.application_id
name = "%s"
action_type = "HTTP_REQUEST"
Expand All @@ -285,7 +283,7 @@ func httpAction(name string, templateName string, variableMap map[string]string)

func configureConfig() string {
return fmt.Sprintf(`
provider "appd" {
provider "appdynamics" {
secret = "%s"
controller_base_url = "%s"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package appd
package appdynamics

import (
"github.com/HarryEMartland/appd-terraform-provider/appd/client"
"github.com/HarryEMartland/terraform-provider-appdynamics/appdynamics/client"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"strconv"
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package appd
package appdynamics

import (
"fmt"
Expand All @@ -13,7 +13,7 @@ func TestAccAppDHealthRule_basicSingleMetricAllBts(t *testing.T) {

name := acctest.RandStringFromCharSet(11, acctest.CharSetAlphaNum)

resourceName := "appd_health_rule.test_all_bts"
resourceName := "appdynamics_health_rule.test_all_bts"
aggregationFunction := "VALUE"
detailType := "SINGLE_METRIC"
entityType := "BUSINESS_TRANSACTION_PERFORMANCE"
Expand All @@ -23,7 +23,7 @@ func TestAccAppDHealthRule_basicSingleMetricAllBts(t *testing.T) {
criticalValue := "2"
resource.Test(t, resource.TestCase{
Providers: map[string]terraform.ResourceProvider{
"appd": Provider(),
"appdynamics": Provider(),
},
Steps: []resource.TestStep{
{
Expand Down Expand Up @@ -53,7 +53,7 @@ func TestAccAppDHealthRule_updateSingleMetricAllBts(t *testing.T) {

name := acctest.RandStringFromCharSet(11, acctest.CharSetAlphaNum)

resourceName := "appd_health_rule.test_all_bts"
resourceName := "appdynamics_health_rule.test_all_bts"
aggregationFunction := "VALUE"
detailType := "SINGLE_METRIC"
entityType := "BUSINESS_TRANSACTION_PERFORMANCE"
Expand All @@ -70,7 +70,7 @@ func TestAccAppDHealthRule_updateSingleMetricAllBts(t *testing.T) {

resource.Test(t, resource.TestCase{
Providers: map[string]terraform.ResourceProvider{
"appd": Provider(),
"appdynamics": Provider(),
},
Steps: []resource.TestStep{
{
Expand Down Expand Up @@ -119,11 +119,11 @@ func TestAccAppDHealthRule_basicSpecificBts(t *testing.T) {
name := acctest.RandStringFromCharSet(11, acctest.CharSetAlphaNum)
bts := []string{bt1}

resourceName := "appd_health_rule.test_specific_bts"
resourceName := "appdynamics_health_rule.test_specific_bts"

resource.Test(t, resource.TestCase{
Providers: map[string]terraform.ResourceProvider{
"appd": Provider(),
"appdynamics": Provider(),
},
Steps: []resource.TestStep{
{
Expand All @@ -147,11 +147,11 @@ func TestAccAppDHealthRule_updateSpecificBts(t *testing.T) {
bts := []string{bt1}
updatedBts := []string{bt1, bt2}

resourceName := "appd_health_rule.test_specific_bts"
resourceName := "appdynamics_health_rule.test_specific_bts"

resource.Test(t, resource.TestCase{
Providers: map[string]terraform.ResourceProvider{
"appd": Provider(),
"appdynamics": Provider(),
},
Steps: []resource.TestStep{
{
Expand Down Expand Up @@ -184,11 +184,11 @@ func TestAccAppDHealthRule_basicSpecificTiers(t *testing.T) {
name := acctest.RandStringFromCharSet(11, acctest.CharSetAlphaNum)
tiers := []string{tier1}

resourceName := "appd_health_rule.test_specific_tiers"
resourceName := "appdynamics_health_rule.test_specific_tiers"

resource.Test(t, resource.TestCase{
Providers: map[string]terraform.ResourceProvider{
"appd": Provider(),
"appdynamics": Provider(),
},
Steps: []resource.TestStep{
{
Expand All @@ -212,11 +212,11 @@ func TestAccAppDHealthRule_updateSpecificTiers(t *testing.T) {
tiers := []string{tier1}
updatedBts := []string{tier1, tier2}

resourceName := "appd_health_rule.test_specific_tiers"
resourceName := "appdynamics_health_rule.test_specific_tiers"

resource.Test(t, resource.TestCase{
Providers: map[string]terraform.ResourceProvider{
"appd": Provider(),
"appdynamics": Provider(),
},
Steps: []resource.TestStep{
{
Expand Down Expand Up @@ -291,7 +291,7 @@ func CheckHealthRuleDoesNotExist(resourceName string) func(state *terraform.Stat
func allBTsHealthRule(name string, aggregationFunction string, detailType string, entityType string, metric string, compareCondition string, warnValue string, criticalValue string) string {
return fmt.Sprintf(`
%s
resource "appd_health_rule" "test_all_bts" {
resource "appdynamics_health_rule" "test_all_bts" {
name = "%s"
application_id = var.application_id
metric_aggregation_function = "%s"
Expand All @@ -310,7 +310,7 @@ func allBTsHealthRule(name string, aggregationFunction string, detailType string
func specificBTsHealthRule(name string, bts []string) string {
return fmt.Sprintf(`
%s
resource "appd_health_rule" "test_specific_bts" {
resource "appdynamics_health_rule" "test_specific_bts" {
name = "%s"
application_id = var.application_id
metric_aggregation_function = "VALUE"
Expand All @@ -330,7 +330,7 @@ func specificBTsHealthRule(name string, bts []string) string {
func specificTiersHealthRule(name string, tiers []string) string {
return fmt.Sprintf(`
%s
resource "appd_health_rule" "test_specific_tiers" {
resource "appdynamics_health_rule" "test_specific_tiers" {
name = "%s"
application_id = var.application_id
metric_aggregation_function = "VALUE"
Expand Down
4 changes: 2 additions & 2 deletions appd/resource_policy.go → appdynamics/resource_policy.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package appd
package appdynamics

import (
"github.com/HarryEMartland/appd-terraform-provider/appd/client"
"github.com/HarryEMartland/terraform-provider-appdynamics/appdynamics/client"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"strconv"
)
Expand Down
Loading

0 comments on commit 360c478

Please sign in to comment.