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

The new azure provider can be used #2

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,26 @@ Go to the `tf` directory:

```bash
cd tf
chmod +x *.sh
```

*Optional: update the `variables.tf` and `aks.tf` files with desired values.*

With the following command we’ll create a new service principal and skip creating the default assignment, which allows the service principal to access resources under the current subscription.


```hcl
$ az ad sp create-for-rbac --skip-assignment
{
“appId”: “xyzxyzxyzxyzxyzxyzxyzxyzxyzxyz”, → — service-principal
“displayName”: “azure-cli-2019–02–23–11-xyz”,
“name”: “http://azure-cli-2019-02-23-11-31-36",
“password”: “xyzxyzxyzxyzxyzxyzxyzxyzxyzxyz”, → — client-secret
“tenant”: “xyzxyzxyzxyzxyzxyzxyzxyzxyzxyz”
}
```


Export the following environment variables for the service principal client id and client secret that should be used by the Azure Kubernetes Service cluster:

```bash
Expand Down
4 changes: 2 additions & 2 deletions tf/aks.tf
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ resource "azurerm_kubernetes_cluster" "aks" {
}
}

data "azurerm_azuread_service_principal" "akssp" {
data "azuread_service_principal" "akssp" {
application_id = "${var.client_id}"
}

resource "azurerm_role_assignment" "netcontribrole" {
scope = "${azurerm_subnet.subnet.id}"
role_definition_name = "Network Contributor"
principal_id = "${data.azurerm_azuread_service_principal.akssp.object_id}"
principal_id = "${data.azuread_service_principal.akssp.object_id}"
}
6 changes: 6 additions & 0 deletions tf/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
provider "azurerm" {
version = "~>1.23"
}
*/

provider "azuread" {
version = "=0.1.0"
}