Skip to content

Commit

Permalink
rename account to team
Browse files Browse the repository at this point in the history
  • Loading branch information
ramonsnir committed Jun 13, 2024
1 parent 5c10124 commit 0ae3474
Show file tree
Hide file tree
Showing 22 changed files with 141 additions and 141 deletions.
4 changes: 2 additions & 2 deletions docs/data-sources/dns_zone.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ description: |-

### Read-Only

- `account_id` (String)
- `account_slug` (String)
- `dns_servers` (List of String)
- `domain` (Attributes) (see [below for nested schema](#nestedatt--domain))
- `id` (String) The ID of this resource.
- `records` (Attributes List) (see [below for nested schema](#nestedatt--records))
- `team_id` (String)
- `team_slug` (String)

<a id="nestedatt--domain"></a>
### Nested Schema for `domain`
Expand Down
2 changes: 1 addition & 1 deletion docs/data-sources/site.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ description: |-

### Optional

- `account_slug` (String)
- `name` (String)
- `team_slug` (String)

### Read-Only

Expand Down
4 changes: 2 additions & 2 deletions docs/data-sources/sites.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ description: |-

### Required

- `account_slug` (String)
- `team_slug` (String)

### Read-Only

Expand All @@ -28,8 +28,8 @@ description: |-

Read-Only:

- `account_slug` (String)
- `custom_domain` (String)
- `domain_aliases` (List of String)
- `id` (String)
- `name` (String)
- `team_slug` (String)
4 changes: 2 additions & 2 deletions docs/data-sources/account.md → docs/data-sources/team.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "netlify_account Data Source - netlify"
page_title: "netlify_team Data Source - netlify"
subcategory: ""
description: |-
---

# netlify_account (Data Source)
# netlify_team (Data Source)



Expand Down
4 changes: 2 additions & 2 deletions docs/resources/dns_zone.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ description: |-

### Required

- `account_slug` (String)
- `name` (String)
- `team_slug` (String)

### Read-Only

- `account_id` (String)
- `dns_servers` (List of String)
- `domain` (Attributes) (see [below for nested schema](#nestedatt--domain))
- `id` (String) The ID of this resource.
- `last_updated` (String)
- `team_id` (String)

<a id="nestedatt--domain"></a>
### Nested Schema for `domain`
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/environment_variable.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ description: |-

### Required

- `account_id` (String)
- `key` (String)
- `team_id` (String)

### Optional

Expand Down
2 changes: 1 addition & 1 deletion docs/resources/site_firewall_traffic_rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ description: |-

### Read-Only

- `account_id` (String)
- `last_updated` (String)
- `team_id` (String)

<a id="nestedatt--published"></a>
### Nested Schema for `published`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "netlify_account_firewall_traffic_rules Resource - netlify"
page_title: "netlify_team_firewall_traffic_rules Resource - netlify"
subcategory: ""
description: |-
---

# netlify_account_firewall_traffic_rules (Resource)
# netlify_team_firewall_traffic_rules (Resource)



Expand All @@ -17,8 +17,8 @@ description: |-

### Required

- `account_id` (String)
- `published` (Attributes) (see [below for nested schema](#nestedatt--published))
- `team_id` (String)
- `unpublished` (Attributes) (see [below for nested schema](#nestedatt--unpublished))

### Read-Only
Expand Down
6 changes: 3 additions & 3 deletions examples/dns/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ terraform {
# `token` comes from NETLIFY_API_TOKEN, but can be specified with a Terraform variable
provider "netlify" {}

# data "netlify_account" "current" {
# data "netlify_team" "current" {
# slug = "ramon-test-1"
# }

resource "netlify_dns_zone" "example" {
account_slug = "ramon-test-1" // data.netlify_account.current.slug
name = "example-tf-test-test.com"
team_slug = "ramon-test-1" // data.netlify_team.current.slug
name = "example-tf-test-test.com"
lifecycle {
prevent_destroy = true
}
Expand Down
28 changes: 14 additions & 14 deletions examples/env_vars/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ terraform {
# `token` comes from NETLIFY_API_TOKEN, but can be specified with a Terraform variable
provider "netlify" {}

data "netlify_account" "current" {
data "netlify_team" "current" {
slug = "ramon-test-1"
}

data "netlify_site" "platform_test" {
account_slug = data.netlify_account.current.slug
name = "platform-test-1"
team_slug = data.netlify_team.current.slug
name = "platform-test-1"
}

resource "netlify_environment_variable" "woof" {
account_id = data.netlify_account.current.id
site_id = data.netlify_site.platform_test.id
key = "WOOF"
team_id = data.netlify_team.current.id
site_id = data.netlify_site.platform_test.id
key = "WOOF"
values = [
{
value = "dogs are here",
Expand All @@ -32,9 +32,9 @@ resource "netlify_environment_variable" "woof" {
}

resource "netlify_environment_variable" "meow" {
account_id = data.netlify_account.current.id
site_id = data.netlify_site.platform_test.id
key = "TEST_MEOW"
team_id = data.netlify_team.current.id
site_id = data.netlify_site.platform_test.id
key = "TEST_MEOW"
values = [
{
value = "roflmaocopter",
Expand All @@ -44,9 +44,9 @@ resource "netlify_environment_variable" "meow" {
}

resource "netlify_environment_variable" "secret_meow" {
account_id = data.netlify_account.current.id
site_id = data.netlify_site.platform_test.id
key = "SECRET_TEST_MEOW"
team_id = data.netlify_team.current.id
site_id = data.netlify_site.platform_test.id
key = "SECRET_TEST_MEOW"
secret_values = [
{
value = "secret roflmaocopter",
Expand All @@ -60,8 +60,8 @@ resource "netlify_environment_variable" "secret_meow" {
}

resource "netlify_environment_variable" "global_meow" {
account_id = data.netlify_account.current.id
key = "TEST_MEOW"
team_id = data.netlify_team.current.id
key = "TEST_MEOW"
values = [
{
value = "global roflmaocopter",
Expand Down
6 changes: 3 additions & 3 deletions examples/firewall_traffic_rules/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ terraform {
provider "netlify" {}

data "netlify_site" "test4" {
account_slug = "netlify-testing"
name = "ramontest4"
team_slug = "netlify-testing"
name = "ramontest4"
}

# TODO: add an example for netlify_account_firewall_traffic_rules
# TODO: add an example for netlify_team_firewall_traffic_rules

resource "netlify_site_firewall_traffic_rules" "ramontest4" {
site_id = data.netlify_site.test4.id
Expand Down
4 changes: 2 additions & 2 deletions examples/log_drains/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ terraform {
provider "netlify" {}

data "netlify_site" "test4" {
account_slug = "netlify-testing"
name = "ramontest4"
team_slug = "netlify-testing"
name = "ramontest4"
}

resource "netlify_log_drain" "ramontest4" {
Expand Down
8 changes: 4 additions & 4 deletions examples/site_data_sources/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ terraform {
# `token` comes from NETLIFY_API_TOKEN, but can be specified with a Terraform variable
provider "netlify" {}

data "netlify_account" "current" {
data "netlify_team" "current" {
slug = "ramon-test-1"
}

data "netlify_site" "platform_test" {
account_slug = data.netlify_account.current.slug
name = "platform-test-1"
team_slug = data.netlify_team.current.slug
name = "platform-test-1"
}

data "netlify_sites" "all" {
account_slug = "netlify-testing"
team_slug = "netlify-testing"
}

output "sites" {
Expand Down
4 changes: 2 additions & 2 deletions examples/site_settings/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ terraform {
provider "netlify" {}

data "netlify_site" "platform_test" {
account_slug = "ramon-test-1"
name = "platform-test-1"
team_slug = "ramon-test-1"
name = "platform-test-1"
}

resource "netlify_site_build_settings" "platform_test" {
Expand Down
22 changes: 11 additions & 11 deletions internal/provider/dns_zone_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ type dnsZoneDataSource struct {
}

type dnsZoneDataSourceModel struct {
ID types.String `tfsdk:"id"`
Name types.String `tfsdk:"name"`
AccountID types.String `tfsdk:"account_id"`
AccountSlug types.String `tfsdk:"account_slug"`
DnsServers types.List `tfsdk:"dns_servers"`
Domain *netlifyDomainModel `tfsdk:"domain"`
Records []dnsRecordModel `tfsdk:"records"`
ID types.String `tfsdk:"id"`
Name types.String `tfsdk:"name"`
TeamID types.String `tfsdk:"team_id"`
TeamSlug types.String `tfsdk:"team_slug"`
DnsServers types.List `tfsdk:"dns_servers"`
Domain *netlifyDomainModel `tfsdk:"domain"`
Records []dnsRecordModel `tfsdk:"records"`
}

type dnsRecordModel struct {
Expand Down Expand Up @@ -84,10 +84,10 @@ func (d *dnsZoneDataSource) Schema(_ context.Context, _ datasource.SchemaRequest
Optional: true,
Computed: true,
},
"account_id": schema.StringAttribute{
"team_id": schema.StringAttribute{
Computed: true,
},
"account_slug": schema.StringAttribute{
"team_slug": schema.StringAttribute{
Computed: true,
},
"domain": schema.SingleNestedAttribute{
Expand Down Expand Up @@ -201,8 +201,8 @@ func (d *dnsZoneDataSource) Read(ctx context.Context, req datasource.ReadRequest

config.ID = types.StringValue(zone.Id)
config.Name = types.StringValue(zone.Name)
config.AccountID = types.StringValue(zone.AccountId)
config.AccountSlug = types.StringValue(zone.AccountSlug)
config.TeamID = types.StringValue(zone.AccountId)
config.TeamSlug = types.StringValue(zone.AccountSlug)
dnsServers := make([]types.String, len(zone.DnsServers))
for i, dnsServer := range zone.DnsServers {
dnsServers[i] = types.StringValue(dnsServer)
Expand Down
20 changes: 10 additions & 10 deletions internal/provider/dns_zone_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ type dnsZoneResourceModel struct {
ID types.String `tfsdk:"id"`
LastUpdated types.String `tfsdk:"last_updated"`
Name types.String `tfsdk:"name"`
AccountID types.String `tfsdk:"account_id"`
AccountSlug types.String `tfsdk:"account_slug"`
TeamID types.String `tfsdk:"team_id"`
TeamSlug types.String `tfsdk:"team_slug"`
DnsServers types.List `tfsdk:"dns_servers"`
Domain *netlifyDomainModel `tfsdk:"domain"`
}
Expand Down Expand Up @@ -80,13 +80,13 @@ func (r *dnsZoneResource) Schema(_ context.Context, _ resource.SchemaRequest, re
stringplanmodifier.RequiresReplace(),
},
},
"account_id": schema.StringAttribute{
"team_id": schema.StringAttribute{
Computed: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
},
},
"account_slug": schema.StringAttribute{
"team_slug": schema.StringAttribute{
Required: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.RequiresReplace(),
Expand Down Expand Up @@ -139,25 +139,25 @@ func (r *dnsZoneResource) Create(ctx context.Context, req resource.CreateRequest
dnsZone, _, err := r.data.client.DNSZonesAPI.
CreateDnsZone(ctx).
DnsZoneCreateParams(netlifyapi.DnsZoneCreateParams{
AccountSlug: plan.AccountSlug.ValueStringPointer(),
AccountSlug: plan.TeamSlug.ValueStringPointer(),
Name: plan.Name.ValueStringPointer(),
}).
Execute()
if err != nil {
resp.Diagnostics.AddError(
"Error creating Netlify DNS zone",
fmt.Sprintf(
"Could not create Netlify DNS zone %q (account slug: %q): %q",
"Could not create Netlify DNS zone %q (team slug: %q): %q",
plan.Name.ValueString(),
plan.AccountSlug.ValueString(),
plan.TeamSlug.ValueString(),
err.Error(),
),
)
return
}
plan.ID = types.StringValue(dnsZone.Id)
plan.LastUpdated = types.StringValue(time.Now().Format(time.RFC3339))
plan.AccountID = types.StringValue(dnsZone.AccountId)
plan.TeamID = types.StringValue(dnsZone.AccountId)
dnsServers := make([]types.String, len(dnsZone.DnsServers))
for i, dnsServer := range dnsZone.DnsServers {
dnsServers[i] = types.StringValue(dnsServer)
Expand Down Expand Up @@ -217,8 +217,8 @@ func (r *dnsZoneResource) Read(ctx context.Context, req resource.ReadRequest, re
return
}
state.Name = types.StringValue(dnsZone.Name)
state.AccountID = types.StringValue(dnsZone.AccountId)
state.AccountSlug = types.StringValue(dnsZone.AccountSlug)
state.TeamID = types.StringValue(dnsZone.AccountId)
state.TeamSlug = types.StringValue(dnsZone.AccountSlug)
dnsServers := make([]types.String, len(dnsZone.DnsServers))
for i, dnsServer := range dnsZone.DnsServers {
dnsServers[i] = types.StringValue(dnsServer)
Expand Down
Loading

0 comments on commit 0ae3474

Please sign in to comment.