Skip to content

Commit

Permalink
Merge pull request #1740 from carolynvs/sync-v1
Browse files Browse the repository at this point in the history
Sync v1 with the main branch
  • Loading branch information
carolynvs authored Aug 25, 2021
2 parents 9d6be0b + 5620151 commit 9f88c6f
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 35 deletions.
10 changes: 9 additions & 1 deletion ADOPTERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,12 @@ We want to know if you use Porter! Project priorities and funding are based on
adoption. So if you are using Porter, add yourself to this page, or if it needs
to stay private, email [porter-maintainers@lists.cncf.io](mailto:porter-maintainers@lists.cncf.io).

* [Microsoft](https://microsoft.com) - Uses bundles to share best practices and quickstarts for running workloads on Azure.
#### [Microsoft](https://microsoft.com)
Status: Production ✅
Country: United States 🇺🇸
Usage: Microsoft uses bundles to share best practices and quickstarts for running workloads on Azure.

#### [Thinktecture AG](https://thinktecture.com)
Status: Production ✅
Country: Germany 🇩🇪
Usage: We use bundles to handover deliverables to customers in a standardized, reliable, and secure way.
49 changes: 25 additions & 24 deletions examples/azure-terraform/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ Finally, please note how the `porter-terraform` mixin is used:
```yaml
- terraform:
description: "Create Azure CosmosDB and Event Hubs"
input: false
backendConfig:
key: "{{ bundle.name }}.tfstate"
storage_account_name: "{{ bundle.parameters.storage_account_name }}"
Expand Down Expand Up @@ -128,30 +127,30 @@ In order to use this bundle, you'll first need to build it. This is done with th
porter build
```

Once this command has finished, you will see some additional resources in your working directory: a `Dockerfile` and a `.cnab` directory. The `Dockerfile` was generated by Porter and the `porter-terraform` mixin:
Once this command has finished, you will see a `.cnab` directory created in the working directory. This directory contains the `Dockerfile` for the bundle's installer image generated by Porter and the `porter-terraform` mixin:

```bash
$ more Dockerfile
$ more .cnab/Dockerfile
FROM debian:stretch-slim
ARG BUNDLE_DIR
RUN apt-get update && apt-get install -y ca-certificates
# exec mixin has no buildtime dependencies
ENV TERRAFORM_VERSION=0.12.17
ENV TERRAFORM_VERSION=1.0.4
RUN apt-get update && apt-get install -y wget unzip && \
wget https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip && \
unzip terraform_${TERRAFORM_VERSION}_linux_amd64.zip -d /usr/bin
unzip terraform_${TERRAFORM_VERSION}_linux_amd64.zip -d /usr/bin && \
rm terraform_${TERRAFORM_VERSION}_linux_amd64.zip
COPY . $BUNDLE_DIR
RUN cd /cnab/app/terraform && terraform init -backend=false
# exec mixin has no buildtime dependencies
COPY . $BUNDLE_DIR
RUN rm $BUNDLE_DIR/porter.yaml
RUN rm -fr $BUNDLE_DIR/.cnab
COPY .cnab /cnab
COPY porter.yaml $BUNDLE_DIR/porter.yaml
WORKDIR $BUNDLE_DIR
CMD ["/cnab/app/run"]
```
Expand Down Expand Up @@ -236,9 +235,9 @@ Apply complete! Resources: 5 added, 0 changed, 0 destroyed.
Outputs:
cosmos-db-uri = mongodb://porterform-cosmos-db:PfOFJ6kbcO0dQp0jA07PGRzjZkRS81PTU7nLfIjggl0LYV6LnanR8uC3qvPbvyhna9Z01nFJxoKL8bnejKOZCw==@porterform-cosmos-db.documents.azure.com:10255/?ssl=true&replicaSet=globaldb
eventhubs_connection_string = Endpoint=sb://porterform-eventhub-ns.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=kWhJpeuVMGvkbiJs6u6V4oQd/isELXfb05O8Im5XaWk=
eventhubs_topic = porterform-eventhub
cosmos-db-uri = <sensitive>
eventhubs_connection_string = <sensitive>
eventhubs_topic = "porterform-eventhub"
execution completed successfully!
```

Expand All @@ -255,29 +254,31 @@ First, we can get an overview of this installation via `porter installation show
```
$ porter installation show
Name: azure-terraform
Created: 37 minutes ago
Modified: 37 minutes ago
Created: 4 minutes ago
Modified: 4 minutes ago
Outputs:
-----------------------------------------------------------------------------------------------------
Name Type Value
-----------------------------------------------------------------------------------------------------
cosmos-db-uri string mongodb://porterform-cosmos-db:PfOFJ6kbcO0dQp0jA07PGRzjZk...
eventhubs_connection_string string Endpoint=sb://porterform-eventhub-ns.servicebus.windows.n...
storage_account_key string jHb90Ukm1AJ7PySPkltE1dpQv16meV4PAhJuJyURlfeHoeROoNE+aLXQk...
-------------------------------------------------------------------------------------------------------------
Name Type Value
-------------------------------------------------------------------------------------------------------------
cosmos-db-uri string mongodb://porterform-cosmos-db:6At4uDIX0o9k1eMot8kRgjldfe...
eventhubs_connection_string string Endpoint=sb://porterform-eventhub-ns.servicebus.windows.n...
io.cnab.outputs.invocationImageLogs string executing install action from
azure-terraform (installati...
storage_account_key string p6UVIHV7kF4n+/AzzUh7Usd8DzRPJJa5H9KRwrLau0mjcG6QRw298dUxY...
History:
--------------------------------------
Action Timestamp Status
--------------------------------------
install 37 minutes ago succeeded
------------------------------------------------------------------------------
Run ID Action Timestamp Status Has Logs
------------------------------------------------------------------------------
01FDT6GPBXZJD1DEY5ZW6CB9Y8 install 4 minutes ago succeeded true
```

We can also show a specific output via `porter installation output show [NAME]`:

```
$ porter installation output show cosmos-db-uri
mongodb://porterform-cosmos-db:PfOFJ6kbcO0dQp0jA07PGRzjZkRS81PTU7nLfIjggl0LYV6LnanR8uC3qvPbvyhna9Z01nFJxoKL8bnejKOZCw==@porterform-cosmos-db.documents.azure.com:10255/?ssl=true&replicaSet=globaldb
mongodb://porterform-cosmos-db:6At4uDIX0o9k1eMot8kRgjldfeRBDqONIK7bXD03u3GXi1S1YkX2Rfmxj8hqunbxzlU9KLqtZLe3LM7g4GzPAg==@porterform-cosmos-db.mongo.cosmos.azure.com:10255/?ssl=true&replicaSet=globaldb&retrywrites=false&maxIdleTimeMS=120000&appName=@porterform-cosmos-db@
```

## Uninstalling the Bundle
Expand Down
5 changes: 2 additions & 3 deletions examples/azure-terraform/porter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ registry: getporter
mixins:
- arm
- exec
- terraform
- terraform:
clientVersion: 1.0.4

## This section defines what credentials are used for the bundle. In this case, we are operating
## against Azure, so we need some Azure Service Principal information.
Expand Down Expand Up @@ -94,7 +95,6 @@ install:

- terraform:
description: "Create Azure CosmosDB and Event Hubs"
input: false
backendConfig:
key: "{{ bundle.name }}.tfstate"
storage_account_name: "{{ bundle.parameters.storage_account_name }}"
Expand All @@ -115,7 +115,6 @@ install:
upgrade:
- terraform:
description: "Update Azure CosmosDB and Event Hubs"
input: false
vars:
subscription_id: "{{bundle.credentials.subscription_id}}"
tenant_id: "{{bundle.credentials.tenant_id}}"
Expand Down
20 changes: 13 additions & 7 deletions examples/azure-terraform/terraform/main.tf
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
provider "azurerm" {
version = "~>1.41.0"
subscription_id = var.subscription_id
client_id = var.client_id
client_secret = var.client_secret
tenant_id = var.tenant_id
features {}
subscription_id = var.subscription_id
client_id = var.client_id
client_secret = var.client_secret
tenant_id = var.tenant_id
}

terraform {
required_version = "~>0.12.17"
backend "azurerm" {}
required_version = "1.0.4"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "=2.72.0"
}
}
backend "azurerm" {}
}
2 changes: 2 additions & 0 deletions examples/azure-terraform/terraform/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
output "cosmos-db-uri" {
value = azurerm_cosmosdb_account.db.connection_strings[0]
sensitive = true
}

output "eventhubs_connection_string" {
value = azurerm_eventhub_namespace.hubs.default_primary_connection_string
sensitive = true
}

output "eventhubs_topic" {
Expand Down

0 comments on commit 9f88c6f

Please sign in to comment.