consul_intention

Intentions are used to define rules for which services may connect to one another when using Consul Connect.

It is appropriate to either reference existing services, or specify non-existent services that will be created in the future when creating intentions. This resource can be used in conjunction with the consul_service datasource when referencing services registered on nodes that have a running Consul agent.

Example Usage

Create a simplest intention with static service names:

resource "consul_intention" "database" {
  source_name      = "api"
  destination_name = "db"
  action           = "allow"
}

Referencing a known service via a datasource:

resource "consul_intention" "database" {
  source_name      = "api"
  destination_name = "${consul_service.pg.name}"
  action           = "allow"
}

data "consul_service" "pg" {
  name = "postgresql"
}

Argument Reference

The following arguments are supported:

Attributes Reference

The following attributes are exported:

Import

consul_intention can be imported:

$ terraform import consul_intention.database 657a57d6-0d56-57e2-31cb-e9f1ed3c18dd