Skip to content

Commit

Permalink
devspace: making 'host_suffix' computed
Browse files Browse the repository at this point in the history
  • Loading branch information
tombuildsstuff committed Oct 11, 2019
1 parent 8cdda18 commit b629c38
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 20 deletions.
14 changes: 5 additions & 9 deletions azurerm/resource_arm_devspace_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,6 @@ func resourceArmDevSpaceController() *schema.Resource {
},
},

"host_suffix": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validate.NoEmptyStrings,
},

"target_container_host_resource_id": {
Type: schema.TypeString,
Required: true,
Expand All @@ -93,6 +86,11 @@ func resourceArmDevSpaceController() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},

"host_suffix": {
Type: schema.TypeString,
Computed: true,
},
},
}
}
Expand Down Expand Up @@ -125,7 +123,6 @@ func resourceArmDevSpaceControllerCreate(d *schema.ResourceData, meta interface{

sku := expandDevSpaceControllerSku(d)

hostSuffix := d.Get("host_suffix").(string)
tarCHResId := d.Get("target_container_host_resource_id").(string)
tarCHCredBase64 := d.Get("target_container_host_credentials_base64").(string)

Expand All @@ -134,7 +131,6 @@ func resourceArmDevSpaceControllerCreate(d *schema.ResourceData, meta interface{
Tags: tags.Expand(t),
Sku: sku,
ControllerProperties: &devspaces.ControllerProperties{
HostSuffix: &hostSuffix,
TargetContainerHostResourceID: &tarCHResId,
TargetContainerHostCredentialsBase64: &tarCHCredBase64,
},
Expand Down
2 changes: 0 additions & 2 deletions azurerm/resource_arm_devspace_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ resource "azurerm_devspace_controller" "test" {
name = "acctestdsc%d"
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
host_suffix = "suffix"
target_container_host_resource_id = "${azurerm_kubernetes_cluster.test.id}"
target_container_host_credentials_base64 = "${base64encode(azurerm_kubernetes_cluster.test.kube_config_raw)}"
Expand All @@ -184,7 +183,6 @@ resource "azurerm_devspace_controller" "import" {
name = "${azurerm_devspace_controller.test.name}"
location = "${azurerm_devspace_controller.test.location}"
resource_group_name = "${azurerm_devspace_controller.test.resource_group_name}"
host_suffix = "${azurerm_devspace_controller.test.host_suffix}"
target_container_host_resource_id = "${azurerm_kubernetes_cluster.test.id}"
target_container_host_credentials_base64 = "${base64encode(azurerm_kubernetes_cluster.test.kube_config_raw)}"
Expand Down
19 changes: 10 additions & 9 deletions website/docs/r/devspace_controller.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ Manages a DevSpace Controller.
## Example Usage

```hcl
resource "azurerm_resource_group" "test" {
name = "acctestRG1"
location = "westeurope"
resource "azurerm_resource_group" "example" {
name = "example_resources"
location = "West Europe"
}
resource "azurerm_kubernetes_cluster" "test" {
name = "acctestaks1"
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
dns_prefix = "acctestaks1"
agent_pool_profile {
Expand All @@ -38,8 +38,8 @@ resource "azurerm_kubernetes_cluster" "test" {
resource "azurerm_devspace_controller" "test" {
name = "acctestdsc1"
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
sku {
name = "S1"
Expand Down Expand Up @@ -68,8 +68,6 @@ The following arguments are supported:

* `sku` - (Required) A `sku` block as documented below. Changing this forces a new resource to be created.

* `host_suffix` - (Required) The host suffix for the DevSpace Controller. Changing this forces a new resource to be created.

* `target_container_host_resource_id` - (Required) The resource id of Azure Kubernetes Service cluster. Changing this forces a new resource to be created.

* `target_container_host_credentials_base64` - (Required) Base64 encoding of `kube_config_raw` of Azure Kubernetes Service cluster. Changing this forces a new resource to be created.
Expand All @@ -91,6 +89,9 @@ The following attributes are exported:

* `data_plane_fqdn` - DNS name for accessing DataPlane services.

* `host_suffix` - The host suffix for the DevSpace Controller.


## Import

DevSpace Controller's can be imported using the `resource id`, e.g.
Expand Down

0 comments on commit b629c38

Please sign in to comment.