Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: merge commercetools_tax_category_rate into commercetools_tax_category #291

Open
mvantellingen opened this issue Aug 8, 2022 · 0 comments · May be fixed by #477
Open

Proposal: merge commercetools_tax_category_rate into commercetools_tax_category #291

mvantellingen opened this issue Aug 8, 2022 · 0 comments · May be fixed by #477
Assignees
Labels
enhancement New feature or request

Comments

@mvantellingen
Copy link
Member

We have created a separate resource for the rates within a tax category.

So now to define a tax category you need:

resource "commercetools_tax_category" "my-tax-category" {
  name        = "Standard tax category"
  description = "Example category"
}

resource "commercetools_tax_category_rate" "standard-tax-category-DE" {
  tax_category_id   = commercetools_tax_category.my-tax-category.id
  name              = "19% MwSt"
  amount            = 0.19
  included_in_price = false
  country           = "DE"
  sub_rate {
    name   = "example"
    amount = 0.19
  }
}

In commercetools there is only one resource: the category. By splitting them in terraform in two separate resources we created a 'virtual' resource which does all the actions on the tax category referenced in the resource. So create,update and delete are all updates on the tax category resource.

Alternative approach:

resource "commercetools_tax_category" "my-tax-category" {
  name        = "Standard tax category"
  description = "Example category"

  rate {
    name              = "19% MwSt"
    amount            = 0.19
    included_in_price = false
    country           = "DE"

    sub_rate {
      name   = "example"
      amount = 0.19
    }
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants