remote: Rename mas to azure (#7114)
MAS wasn't obvious it was Azure so renamed it to Azure
This commit is contained in:
parent
6be1e504e8
commit
32e1a32476
|
@ -12,7 +12,7 @@ import (
|
||||||
riviera "github.com/jen20/riviera/azure"
|
riviera "github.com/jen20/riviera/azure"
|
||||||
)
|
)
|
||||||
|
|
||||||
func masFactory(conf map[string]string) (Client, error) {
|
func azureFactory(conf map[string]string) (Client, error) {
|
||||||
storageAccountName, ok := conf["storage_account_name"]
|
storageAccountName, ok := conf["storage_account_name"]
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, fmt.Errorf("missing 'storage_account_name' configuration")
|
return nil, fmt.Errorf("missing 'storage_account_name' configuration")
|
||||||
|
@ -47,7 +47,7 @@ func masFactory(conf map[string]string) (Client, error) {
|
||||||
|
|
||||||
blobClient := storageClient.GetBlobService()
|
blobClient := storageClient.GetBlobService()
|
||||||
|
|
||||||
return &MASClient{
|
return &AzureClient{
|
||||||
blobClient: &blobClient,
|
blobClient: &blobClient,
|
||||||
containerName: containerName,
|
containerName: containerName,
|
||||||
keyName: keyName,
|
keyName: keyName,
|
||||||
|
@ -125,13 +125,13 @@ func confOrEnv(conf map[string]string, confKey, envVar string) (string, bool) {
|
||||||
return value, value != ""
|
return value, value != ""
|
||||||
}
|
}
|
||||||
|
|
||||||
type MASClient struct {
|
type AzureClient struct {
|
||||||
blobClient *mainStorage.BlobStorageClient
|
blobClient *mainStorage.BlobStorageClient
|
||||||
containerName string
|
containerName string
|
||||||
keyName string
|
keyName string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *MASClient) Get() (*Payload, error) {
|
func (c *AzureClient) Get() (*Payload, error) {
|
||||||
blob, err := c.blobClient.GetBlob(c.containerName, c.keyName)
|
blob, err := c.blobClient.GetBlob(c.containerName, c.keyName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if storErr, ok := err.(mainStorage.AzureStorageServiceError); ok {
|
if storErr, ok := err.(mainStorage.AzureStorageServiceError); ok {
|
||||||
|
@ -161,7 +161,7 @@ func (c *MASClient) Get() (*Payload, error) {
|
||||||
return payload, nil
|
return payload, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *MASClient) Put(data []byte) error {
|
func (c *AzureClient) Put(data []byte) error {
|
||||||
return c.blobClient.CreateBlockBlobFromReader(
|
return c.blobClient.CreateBlockBlobFromReader(
|
||||||
c.containerName,
|
c.containerName,
|
||||||
c.keyName,
|
c.keyName,
|
||||||
|
@ -173,6 +173,6 @@ func (c *MASClient) Put(data []byte) error {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *MASClient) Delete() error {
|
func (c *AzureClient) Delete() error {
|
||||||
return c.blobClient.DeleteBlob(c.containerName, c.keyName, nil)
|
return c.blobClient.DeleteBlob(c.containerName, c.keyName, nil)
|
||||||
}
|
}
|
|
@ -12,13 +12,13 @@ import (
|
||||||
"github.com/jen20/riviera/storage"
|
"github.com/jen20/riviera/storage"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestMASClient_impl(t *testing.T) {
|
func TestAzureClient_impl(t *testing.T) {
|
||||||
var _ Client = new(MASClient)
|
var _ Client = new(AzureClient)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMASClient(t *testing.T) {
|
func TestAzureClient(t *testing.T) {
|
||||||
// This test creates a bucket in MAS and populates it.
|
// This test creates a bucket in Azure and populates it.
|
||||||
// It may incur costs, so it will only run if MAS credential environment
|
// It may incur costs, so it will only run if Azure credential environment
|
||||||
// variables are present.
|
// variables are present.
|
||||||
|
|
||||||
config := map[string]string{
|
config := map[string]string{
|
||||||
|
@ -42,7 +42,7 @@ func TestMASClient(t *testing.T) {
|
||||||
setup(t, config)
|
setup(t, config)
|
||||||
defer teardown(t, config)
|
defer teardown(t, config)
|
||||||
|
|
||||||
client, err := masFactory(config)
|
client, err := azureFactory(config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Error for valid config: %v", err)
|
t.Fatalf("Error for valid config: %v", err)
|
||||||
}
|
}
|
|
@ -37,11 +37,11 @@ func NewClient(t string, conf map[string]string) (Client, error) {
|
||||||
// NewClient.
|
// NewClient.
|
||||||
var BuiltinClients = map[string]Factory{
|
var BuiltinClients = map[string]Factory{
|
||||||
"atlas": atlasFactory,
|
"atlas": atlasFactory,
|
||||||
|
"azure": azureFactory,
|
||||||
"consul": consulFactory,
|
"consul": consulFactory,
|
||||||
"etcd": etcdFactory,
|
"etcd": etcdFactory,
|
||||||
"gcs": gcsFactory,
|
"gcs": gcsFactory,
|
||||||
"http": httpFactory,
|
"http": httpFactory,
|
||||||
"mas": masFactory,
|
|
||||||
"s3": s3Factory,
|
"s3": s3Factory,
|
||||||
"swift": swiftFactory,
|
"swift": swiftFactory,
|
||||||
"artifactory": artifactoryFactory,
|
"artifactory": artifactoryFactory,
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
---
|
---
|
||||||
layout: "remotestate"
|
layout: "remotestate"
|
||||||
page_title: "Remote State Backend: mas"
|
page_title: "Remote State Backend: azure"
|
||||||
sidebar_current: "docs-state-remote-mas"
|
sidebar_current: "docs-state-remote-azure"
|
||||||
description: |-
|
description: |-
|
||||||
Terraform can store the state remotely, making it easier to version and work with in a team.
|
Terraform can store the state remotely, making it easier to version and work with in a team.
|
||||||
---
|
---
|
||||||
|
|
||||||
# mas
|
# azure
|
||||||
|
|
||||||
Stores the state as a given key in a given bucket on [Microsoft Azure Storage](https://azure.microsoft.com/en-us/documentation/articles/storage-introduction/).
|
Stores the state as a given key in a given bucket on [Microsoft Azure Storage](https://azure.microsoft.com/en-us/documentation/articles/storage-introduction/).
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ Use of environment variables or config file is recommended.
|
||||||
|
|
||||||
```
|
```
|
||||||
terraform remote config \
|
terraform remote config \
|
||||||
-backend=mas \
|
-backend=azure \
|
||||||
-backend-config="storage_account_name=terraform123abc" \
|
-backend-config="storage_account_name=terraform123abc" \
|
||||||
-backend-config="container_name=terraform-state" \
|
-backend-config="container_name=terraform-state" \
|
||||||
-backend-config="key=prod.terraform.tfstate"
|
-backend-config="key=prod.terraform.tfstate"
|
||||||
|
@ -29,7 +29,7 @@ terraform remote config \
|
||||||
```hcl
|
```hcl
|
||||||
# setup remote state data source
|
# setup remote state data source
|
||||||
data "terraform_remote_state" "foo" {
|
data "terraform_remote_state" "foo" {
|
||||||
backend = "mas"
|
backend = "azure"
|
||||||
config {
|
config {
|
||||||
storage_account_name = "terraform123abc"
|
storage_account_name = "terraform123abc"
|
||||||
container_name = "terraform-state"
|
container_name = "terraform-state"
|
|
@ -1,49 +1,49 @@
|
||||||
<% wrap_layout :inner do %>
|
<% wrap_layout :inner do %>
|
||||||
<% content_for :sidebar do %>
|
<% content_for :sidebar do %>
|
||||||
<div class="docs-sidebar hidden-print affix-top" role="complementary">
|
<div class="docs-sidebar hidden-print affix-top" role="complementary">
|
||||||
<ul class="nav docs-sidenav">
|
<ul class="nav docs-sidenav">
|
||||||
<li<%= sidebar_current("docs-state") %>>
|
<li<%= sidebar_current("docs-state") %>>
|
||||||
<a href="/docs/state/index.html">« Documentation Home</a>
|
<a href="/docs/state/index.html">« Documentation Home</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li<%= sidebar_current("docs-state-remote_index") %>>
|
<li<%= sidebar_current("docs-state-remote_index") %>>
|
||||||
<a href="/docs/state/remote/index.html">Remote State</a>
|
<a href="/docs/state/remote/index.html">Remote State</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li<%= sidebar_current(/^docs-state-remote-/) %>>
|
<li<%= sidebar_current(/^docs-state-remote-/) %>>
|
||||||
<a href="#">Backends</a>
|
<a href="#">Backends</a>
|
||||||
<ul class="nav nav-visible">
|
<ul class="nav nav-visible">
|
||||||
<li<%= sidebar_current("docs-state-remote-artifactory") %>>
|
<li<%= sidebar_current("docs-state-remote-artifactory") %>>
|
||||||
<a href="/docs/state/remote/artifactory.html">artifactory</a>
|
<a href="/docs/state/remote/artifactory.html">artifactory</a>
|
||||||
</li>
|
</li>
|
||||||
<li<%= sidebar_current("docs-state-remote-mas") %>>
|
<li<%= sidebar_current("docs-state-remote-atlas") %>>
|
||||||
<a href="/docs/state/remote/mas.html">mas</a>
|
<a href="/docs/state/remote/atlas.html">atlas</a>
|
||||||
</li>
|
</li>
|
||||||
<li<%= sidebar_current("docs-state-remote-atlas") %>>
|
<li<%= sidebar_current("docs-state-remote-azure") %>>
|
||||||
<a href="/docs/state/remote/atlas.html">atlas</a>
|
<a href="/docs/state/remote/azure.html">azure</a>
|
||||||
</li>
|
</li>
|
||||||
<li<%= sidebar_current("docs-state-remote-consul") %>>
|
<li<%= sidebar_current("docs-state-remote-consul") %>>
|
||||||
<a href="/docs/state/remote/consul.html">consul</a>
|
<a href="/docs/state/remote/consul.html">consul</a>
|
||||||
</li>
|
</li>
|
||||||
<li<%= sidebar_current("docs-state-remote-etcd") %>>
|
<li<%= sidebar_current("docs-state-remote-etcd") %>>
|
||||||
<a href="/docs/state/remote/etcd.html">etcd</a>
|
<a href="/docs/state/remote/etcd.html">etcd</a>
|
||||||
</li>
|
</li>
|
||||||
<li<%= sidebar_current("docs-state-remote-gcs") %>>
|
<li<%= sidebar_current("docs-state-remote-gcs") %>>
|
||||||
<a href="/docs/state/remote/gcs.html">gcs</a>
|
<a href="/docs/state/remote/gcs.html">gcs</a>
|
||||||
</li>
|
</li>
|
||||||
<li<%= sidebar_current("docs-state-remote-http") %>>
|
<li<%= sidebar_current("docs-state-remote-http") %>>
|
||||||
<a href="/docs/state/remote/http.html">http</a>
|
<a href="/docs/state/remote/http.html">http</a>
|
||||||
</li>
|
</li>
|
||||||
<li<%= sidebar_current("docs-state-remote-s3") %>>
|
<li<%= sidebar_current("docs-state-remote-s3") %>>
|
||||||
<a href="/docs/state/remote/s3.html">s3</a>
|
<a href="/docs/state/remote/s3.html">s3</a>
|
||||||
</li>
|
</li>
|
||||||
<li<%= sidebar_current("docs-state-remote-swift") %>>
|
<li<%= sidebar_current("docs-state-remote-swift") %>>
|
||||||
<a href="/docs/state/remote/swift.html">swift</a>
|
<a href="/docs/state/remote/swift.html">swift</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= yield %>
|
<%= yield %>
|
||||||
|
|
Loading…
Reference in New Issue